1 // Copyright 2024 Google LLC. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 // Code generated file. DO NOT EDIT. 6 7 // Package addressvalidation provides access to the Address Validation API. 8 // 9 // For product documentation, see: https://developers.google.com/maps/documentation/addressvalidation 10 // 11 // # Library status 12 // 13 // These client libraries are officially supported by Google. However, this 14 // library is considered complete and is in maintenance mode. This means 15 // that we will address critical bugs and security issues but will not add 16 // any new features. 17 // 18 // When possible, we recommend using our newer 19 // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) 20 // that are still actively being worked and iterated on. 21 // 22 // # Creating a client 23 // 24 // Usage example: 25 // 26 // import "google.golang.org/api/addressvalidation/v1" 27 // ... 28 // ctx := context.Background() 29 // addressvalidationService, err := addressvalidation.NewService(ctx) 30 // 31 // In this example, Google Application Default Credentials are used for 32 // authentication. For information on how to create and obtain Application 33 // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. 34 // 35 // # Other authentication options 36 // 37 // By default, all available scopes (see "Constants") are used to authenticate. 38 // To restrict scopes, use [google.golang.org/api/option.WithScopes]: 39 // 40 // addressvalidationService, err := addressvalidation.NewService(ctx, option.WithScopes(addressvalidation.MapsPlatformAddressvalidationScope)) 41 // 42 // To use an API key for authentication (note: some APIs do not support API 43 // keys), use [google.golang.org/api/option.WithAPIKey]: 44 // 45 // addressvalidationService, err := addressvalidation.NewService(ctx, option.WithAPIKey("AIza...")) 46 // 47 // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth 48 // flow, use [google.golang.org/api/option.WithTokenSource]: 49 // 50 // config := &oauth2.Config{...} 51 // // ... 52 // token, err := config.Exchange(ctx, ...) 53 // addressvalidationService, err := addressvalidation.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 54 // 55 // See [google.golang.org/api/option.ClientOption] for details on options. 56 package addressvalidation // import "google.golang.org/api/addressvalidation/v1" 57 58 import ( 59 "bytes" 60 "context" 61 "encoding/json" 62 "errors" 63 "fmt" 64 "io" 65 "net/http" 66 "net/url" 67 "strconv" 68 "strings" 69 70 googleapi "google.golang.org/api/googleapi" 71 internal "google.golang.org/api/internal" 72 gensupport "google.golang.org/api/internal/gensupport" 73 option "google.golang.org/api/option" 74 internaloption "google.golang.org/api/option/internaloption" 75 htransport "google.golang.org/api/transport/http" 76 ) 77 78 // Always reference these packages, just in case the auto-generated code 79 // below doesn't. 80 var _ = bytes.NewBuffer 81 var _ = strconv.Itoa 82 var _ = fmt.Sprintf 83 var _ = json.NewDecoder 84 var _ = io.Copy 85 var _ = url.Parse 86 var _ = gensupport.MarshalJSON 87 var _ = googleapi.Version 88 var _ = errors.New 89 var _ = strings.Replace 90 var _ = context.Canceled 91 var _ = internaloption.WithDefaultEndpoint 92 var _ = internal.Version 93 94 const apiId = "addressvalidation:v1" 95 const apiName = "addressvalidation" 96 const apiVersion = "v1" 97 const basePath = "https://addressvalidation.googleapis.com/" 98 const basePathTemplate = "https://addressvalidation.UNIVERSE_DOMAIN/" 99 const mtlsBasePath = "https://addressvalidation.mtls.googleapis.com/" 100 101 // OAuth2 scopes used by this API. 102 const ( 103 // See, edit, configure, and delete your Google Cloud data and see the email 104 // address for your Google Account. 105 CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" 106 107 // Private Service: 108 // https://www.googleapis.com/auth/maps-platform.addressvalidation 109 MapsPlatformAddressvalidationScope = "https://www.googleapis.com/auth/maps-platform.addressvalidation" 110 ) 111 112 // NewService creates a new Service. 113 func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 114 scopesOption := internaloption.WithDefaultScopes( 115 "https://www.googleapis.com/auth/cloud-platform", 116 "https://www.googleapis.com/auth/maps-platform.addressvalidation", 117 ) 118 // NOTE: prepend, so we don't override user-specified scopes. 119 opts = append([]option.ClientOption{scopesOption}, opts...) 120 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 121 opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate)) 122 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 123 opts = append(opts, internaloption.EnableNewAuthLibrary()) 124 client, endpoint, err := htransport.NewClient(ctx, opts...) 125 if err != nil { 126 return nil, err 127 } 128 s, err := New(client) 129 if err != nil { 130 return nil, err 131 } 132 if endpoint != "" { 133 s.BasePath = endpoint 134 } 135 return s, nil 136 } 137 138 // New creates a new Service. It uses the provided http.Client for requests. 139 // 140 // Deprecated: please use NewService instead. 141 // To provide a custom HTTP client, use option.WithHTTPClient. 142 // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 143 func New(client *http.Client) (*Service, error) { 144 if client == nil { 145 return nil, errors.New("client is nil") 146 } 147 s := &Service{client: client, BasePath: basePath} 148 s.V1 = NewV1Service(s) 149 return s, nil 150 } 151 152 type Service struct { 153 client *http.Client 154 BasePath string // API endpoint base URL 155 UserAgent string // optional additional User-Agent fragment 156 157 V1 *V1Service 158 } 159 160 func (s *Service) userAgent() string { 161 if s.UserAgent == "" { 162 return googleapi.UserAgent 163 } 164 return googleapi.UserAgent + " " + s.UserAgent 165 } 166 167 func NewV1Service(s *Service) *V1Service { 168 rs := &V1Service{s: s} 169 return rs 170 } 171 172 type V1Service struct { 173 s *Service 174 } 175 176 // GoogleGeoTypeViewport: A latitude-longitude viewport, represented as two 177 // diagonally opposite `low` and `high` points. A viewport is considered a 178 // closed region, i.e. it includes its boundary. The latitude bounds must range 179 // between -90 to 90 degrees inclusive, and the longitude bounds must range 180 // between -180 to 180 degrees inclusive. Various cases include: - If `low` = 181 // `high`, the viewport consists of that single point. - If `low.longitude` > 182 // `high.longitude`, the longitude range is inverted (the viewport crosses the 183 // 180 degree longitude line). - If `low.longitude` = -180 degrees and 184 // `high.longitude` = 180 degrees, the viewport includes all longitudes. - If 185 // `low.longitude` = 180 degrees and `high.longitude` = -180 degrees, the 186 // longitude range is empty. - If `low.latitude` > `high.latitude`, the 187 // latitude range is empty. Both `low` and `high` must be populated, and the 188 // represented box cannot be empty (as specified by the definitions above). An 189 // empty viewport will result in an error. For example, this viewport fully 190 // encloses New York City: { "low": { "latitude": 40.477398, "longitude": 191 // -74.259087 }, "high": { "latitude": 40.91618, "longitude": -73.70018 } } 192 type GoogleGeoTypeViewport struct { 193 // High: Required. The high point of the viewport. 194 High *GoogleTypeLatLng `json:"high,omitempty"` 195 // Low: Required. The low point of the viewport. 196 Low *GoogleTypeLatLng `json:"low,omitempty"` 197 // ForceSendFields is a list of field names (e.g. "High") to unconditionally 198 // include in API requests. By default, fields with empty or default values are 199 // omitted from API requests. See 200 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 201 // details. 202 ForceSendFields []string `json:"-"` 203 // NullFields is a list of field names (e.g. "High") to include in API requests 204 // with the JSON null value. By default, fields with empty values are omitted 205 // from API requests. See 206 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 207 NullFields []string `json:"-"` 208 } 209 210 func (s *GoogleGeoTypeViewport) MarshalJSON() ([]byte, error) { 211 type NoMethod GoogleGeoTypeViewport 212 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 213 } 214 215 // GoogleMapsAddressvalidationV1Address: Details of the post-processed address. 216 // Post-processing includes correcting misspelled parts of the address, 217 // replacing incorrect parts, and inferring missing parts. 218 type GoogleMapsAddressvalidationV1Address struct { 219 // AddressComponents: Unordered list. The individual address components of the 220 // formatted and corrected address, along with validation information. This 221 // provides information on the validation status of the individual components. 222 // Address components are not ordered in a particular way. Do not make any 223 // assumptions on the ordering of the address components in the list. 224 AddressComponents []*GoogleMapsAddressvalidationV1AddressComponent `json:"addressComponents,omitempty"` 225 // FormattedAddress: The post-processed address, formatted as a single-line 226 // address following the address formatting rules of the region where the 227 // address is located. 228 FormattedAddress string `json:"formattedAddress,omitempty"` 229 // MissingComponentTypes: The types of components that were expected to be 230 // present in a correctly formatted mailing address but were not found in the 231 // input AND could not be inferred. Components of this type are not present in 232 // `formatted_address`, `postal_address`, or `address_components`. An example 233 // might be `['street_number', 'route']` for an input like "Boulder, Colorado, 234 // 80301, USA". The list of possible types can be found here 235 // (https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). 236 MissingComponentTypes []string `json:"missingComponentTypes,omitempty"` 237 // PostalAddress: The post-processed address represented as a postal address. 238 PostalAddress *GoogleTypePostalAddress `json:"postalAddress,omitempty"` 239 // UnconfirmedComponentTypes: The types of the components that are present in 240 // the `address_components` but could not be confirmed to be correct. This 241 // field is provided for the sake of convenience: its contents are equivalent 242 // to iterating through the `address_components` to find the types of all the 243 // components where the confirmation_level is not CONFIRMED or the inferred 244 // flag is not set to `true`. The list of possible types can be found here 245 // (https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). 246 UnconfirmedComponentTypes []string `json:"unconfirmedComponentTypes,omitempty"` 247 // UnresolvedTokens: Any tokens in the input that could not be resolved. This 248 // might be an input that was not recognized as a valid part of an address (for 249 // example in an input like "123235253253 Main St, San Francisco, CA, 94105", 250 // the unresolved tokens may look like `["123235253253"]` since that does not 251 // look like a valid street number. 252 UnresolvedTokens []string `json:"unresolvedTokens,omitempty"` 253 // ForceSendFields is a list of field names (e.g. "AddressComponents") to 254 // unconditionally include in API requests. By default, fields with empty or 255 // default values are omitted from API requests. See 256 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 257 // details. 258 ForceSendFields []string `json:"-"` 259 // NullFields is a list of field names (e.g. "AddressComponents") to include in 260 // API requests with the JSON null value. By default, fields with empty values 261 // are omitted from API requests. See 262 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 263 NullFields []string `json:"-"` 264 } 265 266 func (s *GoogleMapsAddressvalidationV1Address) MarshalJSON() ([]byte, error) { 267 type NoMethod GoogleMapsAddressvalidationV1Address 268 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 269 } 270 271 // GoogleMapsAddressvalidationV1AddressComponent: Represents an address 272 // component, such as a street, city, or state. 273 type GoogleMapsAddressvalidationV1AddressComponent struct { 274 // ComponentName: The name for this component. 275 ComponentName *GoogleMapsAddressvalidationV1ComponentName `json:"componentName,omitempty"` 276 // ComponentType: The type of the address component. See Table 2: Additional 277 // types returned by the Places service 278 // (https://developers.google.com/places/web-service/supported_types#table2) 279 // for a list of possible types. 280 ComponentType string `json:"componentType,omitempty"` 281 // ConfirmationLevel: Indicates the level of certainty that we have that the 282 // component is correct. 283 // 284 // Possible values: 285 // "CONFIRMATION_LEVEL_UNSPECIFIED" - Default value. This value is unused. 286 // "CONFIRMED" - We were able to verify that this component exists and makes 287 // sense in the context of the rest of the address. 288 // "UNCONFIRMED_BUT_PLAUSIBLE" - This component could not be confirmed, but 289 // it is plausible that it exists. For example, a street number within a known 290 // valid range of numbers on a street where specific house numbers are not 291 // known. 292 // "UNCONFIRMED_AND_SUSPICIOUS" - This component was not confirmed and is 293 // likely to be wrong. For example, a neighborhood that does not fit the rest 294 // of the address. 295 ConfirmationLevel string `json:"confirmationLevel,omitempty"` 296 // Inferred: Indicates that the component was not part of the input, but we 297 // inferred it for the address location and believe it should be provided for a 298 // complete address. 299 Inferred bool `json:"inferred,omitempty"` 300 // Replaced: Indicates the name of the component was replaced with a completely 301 // different one, for example a wrong postal code being replaced with one that 302 // is correct for the address. This is not a cosmetic change, the input 303 // component has been changed to a different one. 304 Replaced bool `json:"replaced,omitempty"` 305 // SpellCorrected: Indicates a correction to a misspelling in the component 306 // name. The API does not always flag changes from one spelling variant to 307 // another, such as when changing "centre" to "center". It also does not always 308 // flag common misspellings, such as when changing "Amphitheater Pkwy" to 309 // "Amphitheatre Pkwy". 310 SpellCorrected bool `json:"spellCorrected,omitempty"` 311 // Unexpected: Indicates an address component that is not expected to be 312 // present in a postal address for the given region. We have retained it only 313 // because it was part of the input. 314 Unexpected bool `json:"unexpected,omitempty"` 315 // ForceSendFields is a list of field names (e.g. "ComponentName") to 316 // unconditionally include in API requests. By default, fields with empty or 317 // default values are omitted from API requests. See 318 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 319 // details. 320 ForceSendFields []string `json:"-"` 321 // NullFields is a list of field names (e.g. "ComponentName") to include in API 322 // requests with the JSON null value. By default, fields with empty values are 323 // omitted from API requests. See 324 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 325 NullFields []string `json:"-"` 326 } 327 328 func (s *GoogleMapsAddressvalidationV1AddressComponent) MarshalJSON() ([]byte, error) { 329 type NoMethod GoogleMapsAddressvalidationV1AddressComponent 330 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 331 } 332 333 // GoogleMapsAddressvalidationV1AddressMetadata: The metadata for the address. 334 // `metadata` is not guaranteed to be fully populated for every address sent to 335 // the Address Validation API. 336 type GoogleMapsAddressvalidationV1AddressMetadata struct { 337 // Business: Indicates that this is the address of a business. If unset, 338 // indicates that the value is unknown. 339 Business bool `json:"business,omitempty"` 340 // PoBox: Indicates that the address of a PO box. If unset, indicates that the 341 // value is unknown. 342 PoBox bool `json:"poBox,omitempty"` 343 // Residential: Indicates that this is the address of a residence. If unset, 344 // indicates that the value is unknown. 345 Residential bool `json:"residential,omitempty"` 346 // ForceSendFields is a list of field names (e.g. "Business") to 347 // unconditionally include in API requests. By default, fields with empty or 348 // default values are omitted from API requests. See 349 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 350 // details. 351 ForceSendFields []string `json:"-"` 352 // NullFields is a list of field names (e.g. "Business") to include in API 353 // requests with the JSON null value. By default, fields with empty values are 354 // omitted from API requests. See 355 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 356 NullFields []string `json:"-"` 357 } 358 359 func (s *GoogleMapsAddressvalidationV1AddressMetadata) MarshalJSON() ([]byte, error) { 360 type NoMethod GoogleMapsAddressvalidationV1AddressMetadata 361 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 362 } 363 364 // GoogleMapsAddressvalidationV1ComponentName: A wrapper for the name of the 365 // component. 366 type GoogleMapsAddressvalidationV1ComponentName struct { 367 // LanguageCode: The BCP-47 language code. This will not be present if the 368 // component name is not associated with a language, such as a street number. 369 LanguageCode string `json:"languageCode,omitempty"` 370 // Text: The name text. For example, "5th Avenue" for a street name or "1253" 371 // for a street number. 372 Text string `json:"text,omitempty"` 373 // ForceSendFields is a list of field names (e.g. "LanguageCode") to 374 // unconditionally include in API requests. By default, fields with empty or 375 // default values are omitted from API requests. See 376 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 377 // details. 378 ForceSendFields []string `json:"-"` 379 // NullFields is a list of field names (e.g. "LanguageCode") to include in API 380 // requests with the JSON null value. By default, fields with empty values are 381 // omitted from API requests. See 382 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 383 NullFields []string `json:"-"` 384 } 385 386 func (s *GoogleMapsAddressvalidationV1ComponentName) MarshalJSON() ([]byte, error) { 387 type NoMethod GoogleMapsAddressvalidationV1ComponentName 388 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 389 } 390 391 // GoogleMapsAddressvalidationV1Geocode: Contains information about the place 392 // the input was geocoded to. 393 type GoogleMapsAddressvalidationV1Geocode struct { 394 // Bounds: The bounds of the geocoded place. 395 Bounds *GoogleGeoTypeViewport `json:"bounds,omitempty"` 396 // FeatureSizeMeters: The size of the geocoded place, in meters. This is 397 // another measure of the coarseness of the geocoded location, but in physical 398 // size rather than in semantic meaning. 399 FeatureSizeMeters float64 `json:"featureSizeMeters,omitempty"` 400 // Location: The geocoded location of the input. Using place IDs is preferred 401 // over using addresses, latitude/longitude coordinates, or plus codes. Using 402 // coordinates when routing or calculating driving directions will always 403 // result in the point being snapped to the road nearest to those coordinates. 404 // This may not be a road that will quickly or safely lead to the destination 405 // and may not be near an access point to the property. Additionally, when a 406 // location is reverse geocoded, there is no guarantee that the returned 407 // address will match the original. 408 Location *GoogleTypeLatLng `json:"location,omitempty"` 409 // PlaceId: The PlaceID of the place this input geocodes to. For more 410 // information about Place IDs see here 411 // (https://developers.google.com/maps/documentation/places/web-service/place-id). 412 PlaceId string `json:"placeId,omitempty"` 413 // PlaceTypes: The type(s) of place that the input geocoded to. For example, 414 // `['locality', 'political']`. The full list of types can be found here 415 // (https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). 416 PlaceTypes []string `json:"placeTypes,omitempty"` 417 // PlusCode: The plus code corresponding to the `location`. 418 PlusCode *GoogleMapsAddressvalidationV1PlusCode `json:"plusCode,omitempty"` 419 // ForceSendFields is a list of field names (e.g. "Bounds") to unconditionally 420 // include in API requests. By default, fields with empty or default values are 421 // omitted from API requests. See 422 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 423 // details. 424 ForceSendFields []string `json:"-"` 425 // NullFields is a list of field names (e.g. "Bounds") to include in API 426 // requests with the JSON null value. By default, fields with empty values are 427 // omitted from API requests. See 428 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 429 NullFields []string `json:"-"` 430 } 431 432 func (s *GoogleMapsAddressvalidationV1Geocode) MarshalJSON() ([]byte, error) { 433 type NoMethod GoogleMapsAddressvalidationV1Geocode 434 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 435 } 436 437 func (s *GoogleMapsAddressvalidationV1Geocode) UnmarshalJSON(data []byte) error { 438 type NoMethod GoogleMapsAddressvalidationV1Geocode 439 var s1 struct { 440 FeatureSizeMeters gensupport.JSONFloat64 `json:"featureSizeMeters"` 441 *NoMethod 442 } 443 s1.NoMethod = (*NoMethod)(s) 444 if err := json.Unmarshal(data, &s1); err != nil { 445 return err 446 } 447 s.FeatureSizeMeters = float64(s1.FeatureSizeMeters) 448 return nil 449 } 450 451 // GoogleMapsAddressvalidationV1LanguageOptions: Preview: This feature is in 452 // Preview (pre-GA). Pre-GA products and features might have limited support, 453 // and changes to pre-GA products and features might not be compatible with 454 // other pre-GA versions. Pre-GA Offerings are covered by the Google Maps 455 // Platform Service Specific Terms 456 // (https://cloud.google.com/maps-platform/terms/maps-service-terms). For more 457 // information, see the launch stage descriptions 458 // (https://developers.google.com/maps/launch-stages). Enables the Address 459 // Validation API to include additional information in the response. 460 type GoogleMapsAddressvalidationV1LanguageOptions struct { 461 // ReturnEnglishLatinAddress: Preview: Return a 462 // [google.maps.addressvalidation.v1.Address] in English. See 463 // [google.maps.addressvalidation.v1.ValidationResult.english_latin_address] 464 // for details. 465 ReturnEnglishLatinAddress bool `json:"returnEnglishLatinAddress,omitempty"` 466 // ForceSendFields is a list of field names (e.g. "ReturnEnglishLatinAddress") 467 // to unconditionally include in API requests. By default, fields with empty or 468 // default values are omitted from API requests. See 469 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 470 // details. 471 ForceSendFields []string `json:"-"` 472 // NullFields is a list of field names (e.g. "ReturnEnglishLatinAddress") to 473 // include in API requests with the JSON null value. By default, fields with 474 // empty values are omitted from API requests. See 475 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 476 NullFields []string `json:"-"` 477 } 478 479 func (s *GoogleMapsAddressvalidationV1LanguageOptions) MarshalJSON() ([]byte, error) { 480 type NoMethod GoogleMapsAddressvalidationV1LanguageOptions 481 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 482 } 483 484 // GoogleMapsAddressvalidationV1PlusCode: Plus code (http://plus.codes) is a 485 // location reference with two formats: global code defining a 14mx14m 486 // (1/8000th of a degree) or smaller rectangle, and compound code, replacing 487 // the prefix with a reference location. 488 type GoogleMapsAddressvalidationV1PlusCode struct { 489 // CompoundCode: Place's compound code, such as "33GV+HQ, Ramberg, Norway", 490 // containing the suffix of the global code and replacing the prefix with a 491 // formatted name of a reference entity. 492 CompoundCode string `json:"compoundCode,omitempty"` 493 // GlobalCode: Place's global (full) code, such as "9FWM33GV+HQ", representing 494 // an 1/8000 by 1/8000 degree area (~14 by 14 meters). 495 GlobalCode string `json:"globalCode,omitempty"` 496 // ForceSendFields is a list of field names (e.g. "CompoundCode") to 497 // unconditionally include in API requests. By default, fields with empty or 498 // default values are omitted from API requests. See 499 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 500 // details. 501 ForceSendFields []string `json:"-"` 502 // NullFields is a list of field names (e.g. "CompoundCode") to include in API 503 // requests with the JSON null value. By default, fields with empty values are 504 // omitted from API requests. See 505 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 506 NullFields []string `json:"-"` 507 } 508 509 func (s *GoogleMapsAddressvalidationV1PlusCode) MarshalJSON() ([]byte, error) { 510 type NoMethod GoogleMapsAddressvalidationV1PlusCode 511 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 512 } 513 514 // GoogleMapsAddressvalidationV1ProvideValidationFeedbackRequest: The request 515 // for sending validation feedback. 516 type GoogleMapsAddressvalidationV1ProvideValidationFeedbackRequest struct { 517 // Conclusion: Required. The outcome of the sequence of validation attempts. If 518 // this field is set to `VALIDATION_CONCLUSION_UNSPECIFIED`, an 519 // `INVALID_ARGUMENT` error will be returned. 520 // 521 // Possible values: 522 // "VALIDATION_CONCLUSION_UNSPECIFIED" - This value is unused. If the 523 // `ProvideValidationFeedbackRequest.conclusion` field is set to 524 // `VALIDATION_CONCLUSION_UNSPECIFIED`, an `INVALID_ARGUMENT` error will be 525 // returned. 526 // "VALIDATED_VERSION_USED" - The version of the address returned by the 527 // Address Validation API was used for the transaction. 528 // "USER_VERSION_USED" - The version of the address provided by the user was 529 // used for the transaction 530 // "UNVALIDATED_VERSION_USED" - A version of the address that was entered 531 // after the last validation attempt but that was not re-validated was used for 532 // the transaction. 533 // "UNUSED" - The transaction was abandoned and the address was not used. 534 Conclusion string `json:"conclusion,omitempty"` 535 // ResponseId: Required. The ID of the response that this feedback is for. This 536 // should be the response_id from the first response in a series of address 537 // validation attempts. 538 ResponseId string `json:"responseId,omitempty"` 539 // ForceSendFields is a list of field names (e.g. "Conclusion") to 540 // unconditionally include in API requests. By default, fields with empty or 541 // default values are omitted from API requests. See 542 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 543 // details. 544 ForceSendFields []string `json:"-"` 545 // NullFields is a list of field names (e.g. "Conclusion") to include in API 546 // requests with the JSON null value. By default, fields with empty values are 547 // omitted from API requests. See 548 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 549 NullFields []string `json:"-"` 550 } 551 552 func (s *GoogleMapsAddressvalidationV1ProvideValidationFeedbackRequest) MarshalJSON() ([]byte, error) { 553 type NoMethod GoogleMapsAddressvalidationV1ProvideValidationFeedbackRequest 554 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 555 } 556 557 // GoogleMapsAddressvalidationV1ProvideValidationFeedbackResponse: The response 558 // for validation feedback. The response is empty if the feedback is sent 559 // successfully. 560 type GoogleMapsAddressvalidationV1ProvideValidationFeedbackResponse struct { 561 // ServerResponse contains the HTTP response code and headers from the server. 562 googleapi.ServerResponse `json:"-"` 563 } 564 565 // GoogleMapsAddressvalidationV1UspsAddress: USPS representation of a US 566 // address. 567 type GoogleMapsAddressvalidationV1UspsAddress struct { 568 // City: City name. 569 City string `json:"city,omitempty"` 570 // CityStateZipAddressLine: City + state + postal code. 571 CityStateZipAddressLine string `json:"cityStateZipAddressLine,omitempty"` 572 // Firm: Firm name. 573 Firm string `json:"firm,omitempty"` 574 // FirstAddressLine: First address line. 575 FirstAddressLine string `json:"firstAddressLine,omitempty"` 576 // SecondAddressLine: Second address line. 577 SecondAddressLine string `json:"secondAddressLine,omitempty"` 578 // State: 2 letter state code. 579 State string `json:"state,omitempty"` 580 // Urbanization: Puerto Rican urbanization name. 581 Urbanization string `json:"urbanization,omitempty"` 582 // ZipCode: Postal code e.g. 10009. 583 ZipCode string `json:"zipCode,omitempty"` 584 // ZipCodeExtension: 4-digit postal code extension e.g. 5023. 585 ZipCodeExtension string `json:"zipCodeExtension,omitempty"` 586 // ForceSendFields is a list of field names (e.g. "City") to unconditionally 587 // include in API requests. By default, fields with empty or default values are 588 // omitted from API requests. See 589 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 590 // details. 591 ForceSendFields []string `json:"-"` 592 // NullFields is a list of field names (e.g. "City") to include in API requests 593 // with the JSON null value. By default, fields with empty values are omitted 594 // from API requests. See 595 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 596 NullFields []string `json:"-"` 597 } 598 599 func (s *GoogleMapsAddressvalidationV1UspsAddress) MarshalJSON() ([]byte, error) { 600 type NoMethod GoogleMapsAddressvalidationV1UspsAddress 601 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 602 } 603 604 // GoogleMapsAddressvalidationV1UspsData: The USPS data for the address. 605 // `uspsData` is not guaranteed to be fully populated for every US or PR 606 // address sent to the Address Validation API. It's recommended to integrate 607 // the backup address fields in the response if you utilize uspsData as the 608 // primary part of the response. 609 type GoogleMapsAddressvalidationV1UspsData struct { 610 // AbbreviatedCity: Abbreviated city. 611 AbbreviatedCity string `json:"abbreviatedCity,omitempty"` 612 // AddressRecordType: Type of the address record that matches the input 613 // address. * `F`: FIRM. This is a match to a Firm Record, which is the finest 614 // level of match available for an address. * `G`: GENERAL DELIVERY. This is a 615 // match to a General Delivery record. * `H`: BUILDING / APARTMENT. This is a 616 // match to a Building or Apartment record. * `P`: POST OFFICE BOX. This is a 617 // match to a Post Office Box. * `R`: RURAL ROUTE or HIGHWAY CONTRACT: This is 618 // a match to either a Rural Route or a Highway Contract record, both of which 619 // may have associated Box Number ranges. * `S`: STREET RECORD: This is a match 620 // to a Street record containing a valid primary number range. 621 AddressRecordType string `json:"addressRecordType,omitempty"` 622 // CarrierRoute: The carrier route code. A four character code consisting of a 623 // one letter prefix and a three digit route designator. Prefixes: * `C`: 624 // Carrier route (or city route) * `R`: Rural route * `H`: Highway Contract 625 // Route * `B`: Post Office Box Section * `G`: General delivery unit 626 CarrierRoute string `json:"carrierRoute,omitempty"` 627 // CarrierRouteIndicator: Carrier route rate sort indicator. 628 CarrierRouteIndicator string `json:"carrierRouteIndicator,omitempty"` 629 // CassProcessed: Indicator that the request has been CASS processed. 630 CassProcessed bool `json:"cassProcessed,omitempty"` 631 // County: County name. 632 County string `json:"county,omitempty"` 633 // DefaultAddress: Indicator that a default address was found, but more 634 // specific addresses exists. 635 DefaultAddress bool `json:"defaultAddress,omitempty"` 636 // DeliveryPointCheckDigit: The delivery point check digit. This number is 637 // added to the end of the delivery_point_barcode for mechanically scanned 638 // mail. Adding all the digits of the delivery_point_barcode, 639 // delivery_point_check_digit, postal code, and ZIP+4 together should yield a 640 // number divisible by 10. 641 DeliveryPointCheckDigit string `json:"deliveryPointCheckDigit,omitempty"` 642 // DeliveryPointCode: 2 digit delivery point code 643 DeliveryPointCode string `json:"deliveryPointCode,omitempty"` 644 // DpvCmra: Indicates if the address is a CMRA (Commercial Mail Receiving 645 // Agency)--a private business receiving mail for clients. Returns a single 646 // character. * `Y`: The address is a CMRA * `N`: The address is not a CMRA 647 DpvCmra string `json:"dpvCmra,omitempty"` 648 // DpvConfirmation: The possible values for DPV confirmation. Returns a single 649 // character or returns no value. * `N`: Primary and any secondary number 650 // information failed to DPV confirm. * `D`: Address was DPV confirmed for the 651 // primary number only, and the secondary number information was missing. * 652 // `S`: Address was DPV confirmed for the primary number only, and the 653 // secondary number information was present but not confirmed. * `Y`: Address 654 // was DPV confirmed for primary and any secondary numbers. * Empty: If the 655 // response does not contain a `dpv_confirmation` value, the address was not 656 // submitted for DPV confirmation. 657 DpvConfirmation string `json:"dpvConfirmation,omitempty"` 658 // DpvDoorNotAccessible: Flag indicates addresses where USPS cannot knock on a 659 // door to deliver mail. Returns a single character. * `Y`: The door is not 660 // accessible. * `N`: No indication the door is not accessible. 661 DpvDoorNotAccessible string `json:"dpvDoorNotAccessible,omitempty"` 662 // DpvDrop: Flag indicates mail is delivered to a single receptable at a site. 663 // Returns a single character. * `Y`: The mail is delivered to a single 664 // receptable at a site. * `N`: The mail is not delivered to a single 665 // receptable at a site. 666 DpvDrop string `json:"dpvDrop,omitempty"` 667 // DpvEnhancedDeliveryCode: Indicates that more than one DPV return code is 668 // valid for the address. Returns a single character. * `Y`: Address was DPV 669 // confirmed for primary and any secondary numbers. * `N`: Primary and any 670 // secondary number information failed to DPV confirm. * `S`: Address was DPV 671 // confirmed for the primary number only, and the secondary number information 672 // was present by not confirmed, or a single trailing alpha on a primary number 673 // was dropped to make a DPV match and secondary information required. * `D`: 674 // Address was DPV confirmed for the primary number only, and the secondary 675 // number information was missing. * `R`: Address confirmed but assigned to 676 // phantom route R777 and R779 and USPS delivery is not provided. 677 DpvEnhancedDeliveryCode string `json:"dpvEnhancedDeliveryCode,omitempty"` 678 // DpvFootnote: The footnotes from delivery point validation. Multiple 679 // footnotes may be strung together in the same string. * `AA`: Input address 680 // matched to the ZIP+4 file * `A1`: Input address was not matched to the ZIP+4 681 // file * `BB`: Matched to DPV (all components) * `CC`: Secondary number not 682 // matched and not required * `C1`: Secondary number not matched but required * 683 // `N1`: High-rise address missing secondary number * `M1`: Primary number 684 // missing * `M3`: Primary number invalid * `P1`: Input address PO, RR or HC 685 // box number missing * `P3`: Input address PO, RR, or HC Box number invalid * 686 // `F1`: Input address matched to a military address * `G1`: Input address 687 // matched to a general delivery address * `U1`: Input address matched to a 688 // unique ZIP code * `PB`: Input address matched to PBSA record * `RR`: DPV 689 // confirmed address with PMB information * `R1`: DPV confirmed address without 690 // PMB information * `R7`: Carrier Route R777 or R779 record * `IA`: Informed 691 // Address identified * `TA`: Primary number matched by dropping a trailing 692 // alpha 693 DpvFootnote string `json:"dpvFootnote,omitempty"` 694 // DpvNoSecureLocation: Flag indicates door is accessible, but package will not 695 // be left due to security concerns. Returns a single character. * `Y`: The 696 // package will not be left due to security concerns. * `N`: No indication the 697 // package will not be left due to security concerns. 698 DpvNoSecureLocation string `json:"dpvNoSecureLocation,omitempty"` 699 // DpvNoStat: Is this a no stat address or an active address? No stat addresses 700 // are ones which are not continuously occupied or addresses that the USPS does 701 // not service. Returns a single character. * `Y`: The address is not active * 702 // `N`: The address is active 703 DpvNoStat string `json:"dpvNoStat,omitempty"` 704 // DpvNoStatReasonCode: Indicates the NoStat type. Returns a reason code as 705 // int. * `1`: IDA (Internal Drop Address) – Addresses that do not receive 706 // mail directly from the USPS but are delivered to a drop address that 707 // services them. * `2`: CDS - Addresses that have not yet become deliverable. 708 // For example, a new subdivision where lots and primary numbers have been 709 // determined, but no structure exists yet for occupancy. * `3`: Collision - 710 // Addresses that do not actually DPV confirm. * `4`: CMZ (College, Military 711 // and Other Types) - ZIP + 4 records USPS has incorporated into the data. * 712 // `5`: Regular - Indicates addresses not receiving delivery and the addresses 713 // are not counted as possible deliveries. * `6`: Secondary Required - The 714 // address requires secondary information. 715 DpvNoStatReasonCode int64 `json:"dpvNoStatReasonCode,omitempty"` 716 // DpvNonDeliveryDays: Flag indicates mail delivery is not performed every day 717 // of the week. Returns a single character. * `Y`: The mail delivery is not 718 // performed every day of the week. * `N`: No indication the mail delivery is 719 // not performed every day of the week. 720 DpvNonDeliveryDays string `json:"dpvNonDeliveryDays,omitempty"` 721 // DpvNonDeliveryDaysValues: Integer identifying non-delivery days. It can be 722 // interrogated using bit flags: 0x40 – Sunday is a non-delivery day 0x20 – 723 // Monday is a non-delivery day 0x10 – Tuesday is a non-delivery day 0x08 – 724 // Wednesday is a non-delivery day 0x04 – Thursday is a non-delivery day 0x02 725 // – Friday is a non-delivery day 0x01 – Saturday is a non-delivery day 726 DpvNonDeliveryDaysValues int64 `json:"dpvNonDeliveryDaysValues,omitempty"` 727 // DpvPbsa: Indicates the address was matched to PBSA record. Returns a single 728 // character. * `Y`: The address was matched to PBSA record. * `N`: The address 729 // was not matched to PBSA record. 730 DpvPbsa string `json:"dpvPbsa,omitempty"` 731 // DpvThrowback: Indicates that mail is not delivered to the street address. 732 // Returns a single character. * `Y`: The mail is not delivered to the street 733 // address. * `N`: The mail is delivered to the street address. 734 DpvThrowback string `json:"dpvThrowback,omitempty"` 735 // DpvVacant: Is this place vacant? Returns a single character. * `Y`: The 736 // address is vacant * `N`: The address is not vacant 737 DpvVacant string `json:"dpvVacant,omitempty"` 738 // ElotFlag: eLOT Ascending/Descending Flag (A/D). 739 ElotFlag string `json:"elotFlag,omitempty"` 740 // ElotNumber: Enhanced Line of Travel (eLOT) number. 741 ElotNumber string `json:"elotNumber,omitempty"` 742 // ErrorMessage: Error message for USPS data retrieval. This is populated when 743 // USPS processing is suspended because of the detection of artificially 744 // created addresses. The USPS data fields might not be populated when this 745 // error is present. 746 ErrorMessage string `json:"errorMessage,omitempty"` 747 // EwsNoMatch: The delivery address is matchable, but the EWS file indicates 748 // that an exact match will be available soon. 749 EwsNoMatch bool `json:"ewsNoMatch,omitempty"` 750 // FipsCountyCode: FIPS county code. 751 FipsCountyCode string `json:"fipsCountyCode,omitempty"` 752 // LacsLinkIndicator: LACSLink indicator. 753 LacsLinkIndicator string `json:"lacsLinkIndicator,omitempty"` 754 // LacsLinkReturnCode: LACSLink return code. 755 LacsLinkReturnCode string `json:"lacsLinkReturnCode,omitempty"` 756 // PmbDesignator: PMB (Private Mail Box) unit designator. 757 PmbDesignator string `json:"pmbDesignator,omitempty"` 758 // PmbNumber: PMB (Private Mail Box) number; 759 PmbNumber string `json:"pmbNumber,omitempty"` 760 // PoBoxOnlyPostalCode: PO Box only postal code. 761 PoBoxOnlyPostalCode bool `json:"poBoxOnlyPostalCode,omitempty"` 762 // PostOfficeCity: Main post office city. 763 PostOfficeCity string `json:"postOfficeCity,omitempty"` 764 // PostOfficeState: Main post office state. 765 PostOfficeState string `json:"postOfficeState,omitempty"` 766 // StandardizedAddress: USPS standardized address. 767 StandardizedAddress *GoogleMapsAddressvalidationV1UspsAddress `json:"standardizedAddress,omitempty"` 768 // SuitelinkFootnote: Footnotes from matching a street or highrise record to 769 // suite information. If business name match is found, the secondary number is 770 // returned. * `A`: SuiteLink record match, business address improved. * `00`: 771 // No match, business address is not improved. 772 SuitelinkFootnote string `json:"suitelinkFootnote,omitempty"` 773 // ForceSendFields is a list of field names (e.g. "AbbreviatedCity") to 774 // unconditionally include in API requests. By default, fields with empty or 775 // default values are omitted from API requests. See 776 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 777 // details. 778 ForceSendFields []string `json:"-"` 779 // NullFields is a list of field names (e.g. "AbbreviatedCity") to include in 780 // API requests with the JSON null value. By default, fields with empty values 781 // are omitted from API requests. See 782 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 783 NullFields []string `json:"-"` 784 } 785 786 func (s *GoogleMapsAddressvalidationV1UspsData) MarshalJSON() ([]byte, error) { 787 type NoMethod GoogleMapsAddressvalidationV1UspsData 788 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 789 } 790 791 // GoogleMapsAddressvalidationV1ValidateAddressRequest: The request for 792 // validating an address. 793 type GoogleMapsAddressvalidationV1ValidateAddressRequest struct { 794 // Address: Required. The address being validated. Unformatted addresses should 795 // be submitted via `address_lines`. The total length of the fields in this 796 // input must not exceed 280 characters. Supported regions can be found here 797 // (https://developers.google.com/maps/documentation/address-validation/coverage). 798 // The language_code value in the input address is reserved for future uses and 799 // is ignored today. The validated address result will be populated based on 800 // the preferred language for the given address, as identified by the system. 801 // The Address Validation API ignores the values in recipients and 802 // organization. Any values in those fields will be discarded and not returned. 803 // Please do not set them. 804 Address *GoogleTypePostalAddress `json:"address,omitempty"` 805 // EnableUspsCass: Enables USPS CASS compatible mode. This affects _only_ the 806 // [google.maps.addressvalidation.v1.ValidationResult.usps_data] field of 807 // [google.maps.addressvalidation.v1.ValidationResult]. Note: for USPS CASS 808 // enabled requests for addresses in Puerto Rico, a 809 // [google.type.PostalAddress.region_code] of the `address` must be provided as 810 // "PR", or an [google.type.PostalAddress.administrative_area] of the `address` 811 // must be provided as "Puerto Rico" (case-insensitive) or "PR". It's 812 // recommended to use a componentized `address`, or alternatively specify at 813 // least two [google.type.PostalAddress.address_lines] where the first line 814 // contains the street number and name and the second line contains the city, 815 // state, and zip code. 816 EnableUspsCass bool `json:"enableUspsCass,omitempty"` 817 // LanguageOptions: Optional. Preview: This feature is in Preview (pre-GA). 818 // Pre-GA products and features might have limited support, and changes to 819 // pre-GA products and features might not be compatible with other pre-GA 820 // versions. Pre-GA Offerings are covered by the Google Maps Platform Service 821 // Specific Terms 822 // (https://cloud.google.com/maps-platform/terms/maps-service-terms). For more 823 // information, see the launch stage descriptions 824 // (https://developers.google.com/maps/launch-stages). Enables the Address 825 // Validation API to include additional information in the response. 826 LanguageOptions *GoogleMapsAddressvalidationV1LanguageOptions `json:"languageOptions,omitempty"` 827 // PreviousResponseId: This field must be empty for the first address 828 // validation request. If more requests are necessary to fully validate a 829 // single address (for example if the changes the user makes after the initial 830 // validation need to be re-validated), then each followup request must 831 // populate this field with the response_id from the very first response in the 832 // validation sequence. 833 PreviousResponseId string `json:"previousResponseId,omitempty"` 834 // SessionToken: Optional. A string which identifies an Autocomplete session 835 // for billing purposes. Must be a URL and filename safe base64 string with at 836 // most 36 ASCII characters in length. Otherwise an INVALID_ARGUMENT error is 837 // returned. The session begins when the user makes an Autocomplete query, and 838 // concludes when they select a place and a call to Place Details or Address 839 // Validation is made. Each session can have multiple Autocomplete queries, 840 // followed by one Place Details or Address Validation request. The credentials 841 // used for each request within a session must belong to the same Google Cloud 842 // Console project. Once a session has concluded, the token is no longer valid; 843 // your app must generate a fresh token for each session. If the `sessionToken` 844 // parameter is omitted, or if you reuse a session token, the session is 845 // charged as if no session token was provided (each request is billed 846 // separately). Note: Address Validation can only be used in sessions with the 847 // Autocomplete (New) API, not the Autocomplete API. See 848 // https://developers.google.com/maps/documentation/places/web-service/session-pricing 849 // for more details. 850 SessionToken string `json:"sessionToken,omitempty"` 851 // ForceSendFields is a list of field names (e.g. "Address") to unconditionally 852 // include in API requests. By default, fields with empty or default values are 853 // omitted from API requests. See 854 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 855 // details. 856 ForceSendFields []string `json:"-"` 857 // NullFields is a list of field names (e.g. "Address") to include in API 858 // requests with the JSON null value. By default, fields with empty values are 859 // omitted from API requests. See 860 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 861 NullFields []string `json:"-"` 862 } 863 864 func (s *GoogleMapsAddressvalidationV1ValidateAddressRequest) MarshalJSON() ([]byte, error) { 865 type NoMethod GoogleMapsAddressvalidationV1ValidateAddressRequest 866 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 867 } 868 869 // GoogleMapsAddressvalidationV1ValidateAddressResponse: The response to an 870 // address validation request. 871 type GoogleMapsAddressvalidationV1ValidateAddressResponse struct { 872 // ResponseId: The UUID that identifies this response. If the address needs to 873 // be re-validated, this UUID *must* accompany the new request. 874 ResponseId string `json:"responseId,omitempty"` 875 // Result: The result of the address validation. 876 Result *GoogleMapsAddressvalidationV1ValidationResult `json:"result,omitempty"` 877 878 // ServerResponse contains the HTTP response code and headers from the server. 879 googleapi.ServerResponse `json:"-"` 880 // ForceSendFields is a list of field names (e.g. "ResponseId") to 881 // unconditionally include in API requests. By default, fields with empty or 882 // default values are omitted from API requests. See 883 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 884 // details. 885 ForceSendFields []string `json:"-"` 886 // NullFields is a list of field names (e.g. "ResponseId") to include in API 887 // requests with the JSON null value. By default, fields with empty values are 888 // omitted from API requests. See 889 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 890 NullFields []string `json:"-"` 891 } 892 893 func (s *GoogleMapsAddressvalidationV1ValidateAddressResponse) MarshalJSON() ([]byte, error) { 894 type NoMethod GoogleMapsAddressvalidationV1ValidateAddressResponse 895 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 896 } 897 898 // GoogleMapsAddressvalidationV1ValidationResult: The result of validating an 899 // address. 900 type GoogleMapsAddressvalidationV1ValidationResult struct { 901 // Address: Information about the address itself as opposed to the geocode. 902 Address *GoogleMapsAddressvalidationV1Address `json:"address,omitempty"` 903 // EnglishLatinAddress: Preview: This feature is in Preview (pre-GA). Pre-GA 904 // products and features might have limited support, and changes to pre-GA 905 // products and features might not be compatible with other pre-GA versions. 906 // Pre-GA Offerings are covered by the Google Maps Platform Service Specific 907 // Terms (https://cloud.google.com/maps-platform/terms/maps-service-terms). For 908 // more information, see the launch stage descriptions 909 // (https://developers.google.com/maps/launch-stages). The address translated 910 // to English. Translated addresses are not reusable as API input. The service 911 // provides them so that the user can use their native language to confirm or 912 // deny the validation of the originally-provided address. If part of the 913 // address doesn't have an English translation, the service returns that part 914 // in an alternate language that uses a Latin script. See here 915 // (https://developers.google.com/maps/documentation/address-validation/convert-addresses-english) 916 // for an explanation of how the alternate language is selected. If part of the 917 // address doesn't have any translations or transliterations in a language that 918 // uses a Latin script, the service returns that part in the local language 919 // associated with the address. Enable this output by using the 920 // [google.maps.addressvalidation.v1.LanguageOptions.return_english_latin_addres 921 // s] flag. Note: the 922 // [google.maps.addressvalidation.v1.Address.unconfirmed_component_types] field 923 // in the `english_latin_address` and the 924 // [google.maps.addressvalidation.v1.AddressComponent.confirmation_level] 925 // fields in `english_latin_address.address_components` are not populated. 926 EnglishLatinAddress *GoogleMapsAddressvalidationV1Address `json:"englishLatinAddress,omitempty"` 927 // Geocode: Information about the location and place that the address geocoded 928 // to. 929 Geocode *GoogleMapsAddressvalidationV1Geocode `json:"geocode,omitempty"` 930 // Metadata: Other information relevant to deliverability. `metadata` is not 931 // guaranteed to be fully populated for every address sent to the Address 932 // Validation API. 933 Metadata *GoogleMapsAddressvalidationV1AddressMetadata `json:"metadata,omitempty"` 934 // UspsData: Extra deliverability flags provided by USPS. Only provided in 935 // region `US` and `PR`. 936 UspsData *GoogleMapsAddressvalidationV1UspsData `json:"uspsData,omitempty"` 937 // Verdict: Overall verdict flags 938 Verdict *GoogleMapsAddressvalidationV1Verdict `json:"verdict,omitempty"` 939 // ForceSendFields is a list of field names (e.g. "Address") to unconditionally 940 // include in API requests. By default, fields with empty or default values are 941 // omitted from API requests. See 942 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 943 // details. 944 ForceSendFields []string `json:"-"` 945 // NullFields is a list of field names (e.g. "Address") to include in API 946 // requests with the JSON null value. By default, fields with empty values are 947 // omitted from API requests. See 948 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 949 NullFields []string `json:"-"` 950 } 951 952 func (s *GoogleMapsAddressvalidationV1ValidationResult) MarshalJSON() ([]byte, error) { 953 type NoMethod GoogleMapsAddressvalidationV1ValidationResult 954 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 955 } 956 957 // GoogleMapsAddressvalidationV1Verdict: High level overview of the address 958 // validation result and geocode. 959 type GoogleMapsAddressvalidationV1Verdict struct { 960 // AddressComplete: The address is considered complete if there are no 961 // unresolved tokens, no unexpected or missing address components. If unset, 962 // indicates that the value is `false`. See `missing_component_types`, 963 // `unresolved_tokens` or `unexpected` fields for more details. 964 AddressComplete bool `json:"addressComplete,omitempty"` 965 // GeocodeGranularity: Information about the granularity of the `geocode`. This 966 // can be understood as the semantic meaning of how coarse or fine the geocoded 967 // location is. This can differ from the `validation_granularity` above 968 // occasionally. For example, our database might record the existence of an 969 // apartment number but do not have a precise location for the apartment within 970 // a big apartment complex. In that case, the `validation_granularity` will be 971 // `SUB_PREMISE` but the `geocode_granularity` will be `PREMISE`. 972 // 973 // Possible values: 974 // "GRANULARITY_UNSPECIFIED" - Default value. This value is unused. 975 // "SUB_PREMISE" - Below-building level result, such as an apartment. 976 // "PREMISE" - Building-level result. 977 // "PREMISE_PROXIMITY" - A geocode that approximates the building-level 978 // location of the address. 979 // "BLOCK" - The address or geocode indicates a block. Only used in regions 980 // which have block-level addressing, such as Japan. 981 // "ROUTE" - The geocode or address is granular to route, such as a street, 982 // road, or highway. 983 // "OTHER" - All other granularities, which are bucketed together since they 984 // are not deliverable. 985 GeocodeGranularity string `json:"geocodeGranularity,omitempty"` 986 // HasInferredComponents: At least one address component was inferred (added) 987 // that wasn't in the input, see 988 // [google.maps.addressvalidation.v1.Address.address_components] for details. 989 HasInferredComponents bool `json:"hasInferredComponents,omitempty"` 990 // HasReplacedComponents: At least one address component was replaced, see 991 // [google.maps.addressvalidation.v1.Address.address_components] for details. 992 HasReplacedComponents bool `json:"hasReplacedComponents,omitempty"` 993 // HasUnconfirmedComponents: At least one address component cannot be 994 // categorized or validated, see 995 // [google.maps.addressvalidation.v1.Address.address_components] for details. 996 HasUnconfirmedComponents bool `json:"hasUnconfirmedComponents,omitempty"` 997 // InputGranularity: The granularity of the **input** address. This is the 998 // result of parsing the input address and does not give any validation 999 // signals. For validation signals, refer to `validation_granularity` below. 1000 // For example, if the input address includes a specific apartment number, then 1001 // the `input_granularity` here will be `SUB_PREMISE`. If we cannot match the 1002 // apartment number in the databases or the apartment number is invalid, the 1003 // `validation_granularity` will likely be `PREMISE` or below. 1004 // 1005 // Possible values: 1006 // "GRANULARITY_UNSPECIFIED" - Default value. This value is unused. 1007 // "SUB_PREMISE" - Below-building level result, such as an apartment. 1008 // "PREMISE" - Building-level result. 1009 // "PREMISE_PROXIMITY" - A geocode that approximates the building-level 1010 // location of the address. 1011 // "BLOCK" - The address or geocode indicates a block. Only used in regions 1012 // which have block-level addressing, such as Japan. 1013 // "ROUTE" - The geocode or address is granular to route, such as a street, 1014 // road, or highway. 1015 // "OTHER" - All other granularities, which are bucketed together since they 1016 // are not deliverable. 1017 InputGranularity string `json:"inputGranularity,omitempty"` 1018 // ValidationGranularity: The granularity level that the API can fully 1019 // **validate** the address to. For example, an `validation_granularity` of 1020 // `PREMISE` indicates all address components at the level of `PREMISE` or more 1021 // coarse can be validated. Per address component validation result can be 1022 // found in [google.maps.addressvalidation.v1.Address.address_components]. 1023 // 1024 // Possible values: 1025 // "GRANULARITY_UNSPECIFIED" - Default value. This value is unused. 1026 // "SUB_PREMISE" - Below-building level result, such as an apartment. 1027 // "PREMISE" - Building-level result. 1028 // "PREMISE_PROXIMITY" - A geocode that approximates the building-level 1029 // location of the address. 1030 // "BLOCK" - The address or geocode indicates a block. Only used in regions 1031 // which have block-level addressing, such as Japan. 1032 // "ROUTE" - The geocode or address is granular to route, such as a street, 1033 // road, or highway. 1034 // "OTHER" - All other granularities, which are bucketed together since they 1035 // are not deliverable. 1036 ValidationGranularity string `json:"validationGranularity,omitempty"` 1037 // ForceSendFields is a list of field names (e.g. "AddressComplete") to 1038 // unconditionally include in API requests. By default, fields with empty or 1039 // default values are omitted from API requests. See 1040 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1041 // details. 1042 ForceSendFields []string `json:"-"` 1043 // NullFields is a list of field names (e.g. "AddressComplete") to include in 1044 // API requests with the JSON null value. By default, fields with empty values 1045 // are omitted from API requests. See 1046 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1047 NullFields []string `json:"-"` 1048 } 1049 1050 func (s *GoogleMapsAddressvalidationV1Verdict) MarshalJSON() ([]byte, error) { 1051 type NoMethod GoogleMapsAddressvalidationV1Verdict 1052 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1053 } 1054 1055 // GoogleTypeLatLng: An object that represents a latitude/longitude pair. This 1056 // is expressed as a pair of doubles to represent degrees latitude and degrees 1057 // longitude. Unless specified otherwise, this object must conform to the WGS84 1058 // standard. Values must be within normalized ranges. 1059 type GoogleTypeLatLng struct { 1060 // Latitude: The latitude in degrees. It must be in the range [-90.0, +90.0]. 1061 Latitude float64 `json:"latitude,omitempty"` 1062 // Longitude: The longitude in degrees. It must be in the range [-180.0, 1063 // +180.0]. 1064 Longitude float64 `json:"longitude,omitempty"` 1065 // ForceSendFields is a list of field names (e.g. "Latitude") to 1066 // unconditionally include in API requests. By default, fields with empty or 1067 // default values are omitted from API requests. See 1068 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1069 // details. 1070 ForceSendFields []string `json:"-"` 1071 // NullFields is a list of field names (e.g. "Latitude") to include in API 1072 // requests with the JSON null value. By default, fields with empty values are 1073 // omitted from API requests. See 1074 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1075 NullFields []string `json:"-"` 1076 } 1077 1078 func (s *GoogleTypeLatLng) MarshalJSON() ([]byte, error) { 1079 type NoMethod GoogleTypeLatLng 1080 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1081 } 1082 1083 func (s *GoogleTypeLatLng) UnmarshalJSON(data []byte) error { 1084 type NoMethod GoogleTypeLatLng 1085 var s1 struct { 1086 Latitude gensupport.JSONFloat64 `json:"latitude"` 1087 Longitude gensupport.JSONFloat64 `json:"longitude"` 1088 *NoMethod 1089 } 1090 s1.NoMethod = (*NoMethod)(s) 1091 if err := json.Unmarshal(data, &s1); err != nil { 1092 return err 1093 } 1094 s.Latitude = float64(s1.Latitude) 1095 s.Longitude = float64(s1.Longitude) 1096 return nil 1097 } 1098 1099 // GoogleTypePostalAddress: Represents a postal address, e.g. for postal 1100 // delivery or payments addresses. Given a postal address, a postal service can 1101 // deliver items to a premise, P.O. Box or similar. It is not intended to model 1102 // geographical locations (roads, towns, mountains). In typical usage an 1103 // address would be created via user input or from importing existing data, 1104 // depending on the type of process. Advice on address input / editing: - Use 1105 // an internationalization-ready address widget such as 1106 // https://github.com/google/libaddressinput) - Users should not be presented 1107 // with UI elements for input or editing of fields outside countries where that 1108 // field is used. For more guidance on how to use this schema, please see: 1109 // https://support.google.com/business/answer/6397478 1110 type GoogleTypePostalAddress struct { 1111 // AddressLines: Unstructured address lines describing the lower levels of an 1112 // address. Because values in address_lines do not have type information and 1113 // may sometimes contain multiple values in a single field (e.g. "Austin, TX"), 1114 // it is important that the line order is clear. The order of address lines 1115 // should be "envelope order" for the country/region of the address. In places 1116 // where this can vary (e.g. Japan), address_language is used to make it 1117 // explicit (e.g. "ja" for large-to-small ordering and "ja-Latn" or "en" for 1118 // small-to-large). This way, the most specific line of an address can be 1119 // selected based on the language. The minimum permitted structural 1120 // representation of an address consists of a region_code with all remaining 1121 // information placed in the address_lines. It would be possible to format such 1122 // an address very approximately without geocoding, but no semantic reasoning 1123 // could be made about any of the address components until it was at least 1124 // partially resolved. Creating an address only containing a region_code and 1125 // address_lines, and then geocoding is the recommended way to handle 1126 // completely unstructured addresses (as opposed to guessing which parts of the 1127 // address should be localities or administrative areas). 1128 AddressLines []string `json:"addressLines,omitempty"` 1129 // AdministrativeArea: Optional. Highest administrative subdivision which is 1130 // used for postal addresses of a country or region. For example, this can be a 1131 // state, a province, an oblast, or a prefecture. Specifically, for Spain this 1132 // is the province and not the autonomous community (e.g. "Barcelona" and not 1133 // "Catalonia"). Many countries don't use an administrative area in postal 1134 // addresses. E.g. in Switzerland this should be left unpopulated. 1135 AdministrativeArea string `json:"administrativeArea,omitempty"` 1136 // LanguageCode: Optional. BCP-47 language code of the contents of this address 1137 // (if known). This is often the UI language of the input form or is expected 1138 // to match one of the languages used in the address' country/region, or their 1139 // transliterated equivalents. This can affect formatting in certain countries, 1140 // but is not critical to the correctness of the data and will never affect any 1141 // validation or other non-formatting related operations. If this value is not 1142 // known, it should be omitted (rather than specifying a possibly incorrect 1143 // default). Examples: "zh-Hant", "ja", "ja-Latn", "en". 1144 LanguageCode string `json:"languageCode,omitempty"` 1145 // Locality: Optional. Generally refers to the city/town portion of the 1146 // address. Examples: US city, IT comune, UK post town. In regions of the world 1147 // where localities are not well defined or do not fit into this structure 1148 // well, leave locality empty and use address_lines. 1149 Locality string `json:"locality,omitempty"` 1150 // Organization: Optional. The name of the organization at the address. 1151 Organization string `json:"organization,omitempty"` 1152 // PostalCode: Optional. Postal code of the address. Not all countries use or 1153 // require postal codes to be present, but where they are used, they may 1154 // trigger additional validation with other parts of the address (e.g. 1155 // state/zip validation in the U.S.A.). 1156 PostalCode string `json:"postalCode,omitempty"` 1157 // Recipients: Optional. The recipient at the address. This field may, under 1158 // certain circumstances, contain multiline information. For example, it might 1159 // contain "care of" information. 1160 Recipients []string `json:"recipients,omitempty"` 1161 // RegionCode: Required. CLDR region code of the country/region of the address. 1162 // This is never inferred and it is up to the user to ensure the value is 1163 // correct. See https://cldr.unicode.org/ and 1164 // https://www.unicode.org/cldr/charts/30/supplemental/territory_information.html 1165 // for details. Example: "CH" for Switzerland. 1166 RegionCode string `json:"regionCode,omitempty"` 1167 // Revision: The schema revision of the `PostalAddress`. This must be set to 0, 1168 // which is the latest revision. All new revisions **must** be backward 1169 // compatible with old revisions. 1170 Revision int64 `json:"revision,omitempty"` 1171 // SortingCode: Optional. Additional, country-specific, sorting code. This is 1172 // not used in most regions. Where it is used, the value is either a string 1173 // like "CEDEX", optionally followed by a number (e.g. "CEDEX 7"), or just a 1174 // number alone, representing the "sector code" (Jamaica), "delivery area 1175 // indicator" (Malawi) or "post office indicator" (e.g. Côte d'Ivoire). 1176 SortingCode string `json:"sortingCode,omitempty"` 1177 // Sublocality: Optional. Sublocality of the address. For example, this can be 1178 // neighborhoods, boroughs, districts. 1179 Sublocality string `json:"sublocality,omitempty"` 1180 // ForceSendFields is a list of field names (e.g. "AddressLines") to 1181 // unconditionally include in API requests. By default, fields with empty or 1182 // default values are omitted from API requests. See 1183 // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more 1184 // details. 1185 ForceSendFields []string `json:"-"` 1186 // NullFields is a list of field names (e.g. "AddressLines") to include in API 1187 // requests with the JSON null value. By default, fields with empty values are 1188 // omitted from API requests. See 1189 // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. 1190 NullFields []string `json:"-"` 1191 } 1192 1193 func (s *GoogleTypePostalAddress) MarshalJSON() ([]byte, error) { 1194 type NoMethod GoogleTypePostalAddress 1195 return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields) 1196 } 1197 1198 type V1ProvideValidationFeedbackCall struct { 1199 s *Service 1200 googlemapsaddressvalidationv1providevalidationfeedbackrequest *GoogleMapsAddressvalidationV1ProvideValidationFeedbackRequest 1201 urlParams_ gensupport.URLParams 1202 ctx_ context.Context 1203 header_ http.Header 1204 } 1205 1206 // ProvideValidationFeedback: Feedback about the outcome of the sequence of 1207 // validation attempts. This should be the last call made after a sequence of 1208 // validation calls for the same address, and should be called once the 1209 // transaction is concluded. This should only be sent once for the sequence of 1210 // `ValidateAddress` requests needed to validate an address fully. 1211 func (r *V1Service) ProvideValidationFeedback(googlemapsaddressvalidationv1providevalidationfeedbackrequest *GoogleMapsAddressvalidationV1ProvideValidationFeedbackRequest) *V1ProvideValidationFeedbackCall { 1212 c := &V1ProvideValidationFeedbackCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1213 c.googlemapsaddressvalidationv1providevalidationfeedbackrequest = googlemapsaddressvalidationv1providevalidationfeedbackrequest 1214 return c 1215 } 1216 1217 // Fields allows partial responses to be retrieved. See 1218 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1219 // details. 1220 func (c *V1ProvideValidationFeedbackCall) Fields(s ...googleapi.Field) *V1ProvideValidationFeedbackCall { 1221 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1222 return c 1223 } 1224 1225 // Context sets the context to be used in this call's Do method. 1226 func (c *V1ProvideValidationFeedbackCall) Context(ctx context.Context) *V1ProvideValidationFeedbackCall { 1227 c.ctx_ = ctx 1228 return c 1229 } 1230 1231 // Header returns a http.Header that can be modified by the caller to add 1232 // headers to the request. 1233 func (c *V1ProvideValidationFeedbackCall) Header() http.Header { 1234 if c.header_ == nil { 1235 c.header_ = make(http.Header) 1236 } 1237 return c.header_ 1238 } 1239 1240 func (c *V1ProvideValidationFeedbackCall) doRequest(alt string) (*http.Response, error) { 1241 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1242 var body io.Reader = nil 1243 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlemapsaddressvalidationv1providevalidationfeedbackrequest) 1244 if err != nil { 1245 return nil, err 1246 } 1247 c.urlParams_.Set("alt", alt) 1248 c.urlParams_.Set("prettyPrint", "false") 1249 urls := googleapi.ResolveRelative(c.s.BasePath, "v1:provideValidationFeedback") 1250 urls += "?" + c.urlParams_.Encode() 1251 req, err := http.NewRequest("POST", urls, body) 1252 if err != nil { 1253 return nil, err 1254 } 1255 req.Header = reqHeaders 1256 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1257 } 1258 1259 // Do executes the "addressvalidation.provideValidationFeedback" call. 1260 // Any non-2xx status code is an error. Response headers are in either 1261 // *GoogleMapsAddressvalidationV1ProvideValidationFeedbackResponse.ServerRespons 1262 // e.Header or (if a response was returned at all) in 1263 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 1264 // whether the returned error was because http.StatusNotModified was returned. 1265 func (c *V1ProvideValidationFeedbackCall) Do(opts ...googleapi.CallOption) (*GoogleMapsAddressvalidationV1ProvideValidationFeedbackResponse, error) { 1266 gensupport.SetOptions(c.urlParams_, opts...) 1267 res, err := c.doRequest("json") 1268 if res != nil && res.StatusCode == http.StatusNotModified { 1269 if res.Body != nil { 1270 res.Body.Close() 1271 } 1272 return nil, gensupport.WrapError(&googleapi.Error{ 1273 Code: res.StatusCode, 1274 Header: res.Header, 1275 }) 1276 } 1277 if err != nil { 1278 return nil, err 1279 } 1280 defer googleapi.CloseBody(res) 1281 if err := googleapi.CheckResponse(res); err != nil { 1282 return nil, gensupport.WrapError(err) 1283 } 1284 ret := &GoogleMapsAddressvalidationV1ProvideValidationFeedbackResponse{ 1285 ServerResponse: googleapi.ServerResponse{ 1286 Header: res.Header, 1287 HTTPStatusCode: res.StatusCode, 1288 }, 1289 } 1290 target := &ret 1291 if err := gensupport.DecodeResponse(target, res); err != nil { 1292 return nil, err 1293 } 1294 return ret, nil 1295 } 1296 1297 type V1ValidateAddressCall struct { 1298 s *Service 1299 googlemapsaddressvalidationv1validateaddressrequest *GoogleMapsAddressvalidationV1ValidateAddressRequest 1300 urlParams_ gensupport.URLParams 1301 ctx_ context.Context 1302 header_ http.Header 1303 } 1304 1305 // ValidateAddress: Validates an address. 1306 func (r *V1Service) ValidateAddress(googlemapsaddressvalidationv1validateaddressrequest *GoogleMapsAddressvalidationV1ValidateAddressRequest) *V1ValidateAddressCall { 1307 c := &V1ValidateAddressCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1308 c.googlemapsaddressvalidationv1validateaddressrequest = googlemapsaddressvalidationv1validateaddressrequest 1309 return c 1310 } 1311 1312 // Fields allows partial responses to be retrieved. See 1313 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more 1314 // details. 1315 func (c *V1ValidateAddressCall) Fields(s ...googleapi.Field) *V1ValidateAddressCall { 1316 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1317 return c 1318 } 1319 1320 // Context sets the context to be used in this call's Do method. 1321 func (c *V1ValidateAddressCall) Context(ctx context.Context) *V1ValidateAddressCall { 1322 c.ctx_ = ctx 1323 return c 1324 } 1325 1326 // Header returns a http.Header that can be modified by the caller to add 1327 // headers to the request. 1328 func (c *V1ValidateAddressCall) Header() http.Header { 1329 if c.header_ == nil { 1330 c.header_ = make(http.Header) 1331 } 1332 return c.header_ 1333 } 1334 1335 func (c *V1ValidateAddressCall) doRequest(alt string) (*http.Response, error) { 1336 reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_) 1337 var body io.Reader = nil 1338 body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlemapsaddressvalidationv1validateaddressrequest) 1339 if err != nil { 1340 return nil, err 1341 } 1342 c.urlParams_.Set("alt", alt) 1343 c.urlParams_.Set("prettyPrint", "false") 1344 urls := googleapi.ResolveRelative(c.s.BasePath, "v1:validateAddress") 1345 urls += "?" + c.urlParams_.Encode() 1346 req, err := http.NewRequest("POST", urls, body) 1347 if err != nil { 1348 return nil, err 1349 } 1350 req.Header = reqHeaders 1351 return gensupport.SendRequest(c.ctx_, c.s.client, req) 1352 } 1353 1354 // Do executes the "addressvalidation.validateAddress" call. 1355 // Any non-2xx status code is an error. Response headers are in either 1356 // *GoogleMapsAddressvalidationV1ValidateAddressResponse.ServerResponse.Header 1357 // or (if a response was returned at all) in error.(*googleapi.Error).Header. 1358 // Use googleapi.IsNotModified to check whether the returned error was because 1359 // http.StatusNotModified was returned. 1360 func (c *V1ValidateAddressCall) Do(opts ...googleapi.CallOption) (*GoogleMapsAddressvalidationV1ValidateAddressResponse, error) { 1361 gensupport.SetOptions(c.urlParams_, opts...) 1362 res, err := c.doRequest("json") 1363 if res != nil && res.StatusCode == http.StatusNotModified { 1364 if res.Body != nil { 1365 res.Body.Close() 1366 } 1367 return nil, gensupport.WrapError(&googleapi.Error{ 1368 Code: res.StatusCode, 1369 Header: res.Header, 1370 }) 1371 } 1372 if err != nil { 1373 return nil, err 1374 } 1375 defer googleapi.CloseBody(res) 1376 if err := googleapi.CheckResponse(res); err != nil { 1377 return nil, gensupport.WrapError(err) 1378 } 1379 ret := &GoogleMapsAddressvalidationV1ValidateAddressResponse{ 1380 ServerResponse: googleapi.ServerResponse{ 1381 Header: res.Header, 1382 HTTPStatusCode: res.StatusCode, 1383 }, 1384 } 1385 target := &ret 1386 if err := gensupport.DecodeResponse(target, res); err != nil { 1387 return nil, err 1388 } 1389 return ret, nil 1390 } 1391