1// Copyright 2023 Google LLC 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15syntax = "proto3"; 16 17package google.maps.addressvalidation.v1; 18 19import "google/api/field_behavior.proto"; 20import "google/type/postal_address.proto"; 21 22option cc_enable_arenas = true; 23option csharp_namespace = "Google.Maps.AddressValidation.V1"; 24option go_package = "cloud.google.com/go/maps/addressvalidation/apiv1/addressvalidationpb;addressvalidationpb"; 25option java_multiple_files = true; 26option java_outer_classname = "AddressProto"; 27option java_package = "com.google.maps.addressvalidation.v1"; 28option objc_class_prefix = "GMPAVV1"; 29option php_namespace = "Google\\Maps\\AddressValidation\\V1"; 30option ruby_package = "Google::Maps::AddressValidation::V1"; 31 32// Details of the post-processed address. Post-processing includes 33// correcting misspelled parts of the address, replacing incorrect parts, and 34// inferring missing parts. 35message Address { 36 // The post-processed address, formatted as a single-line address following 37 // the address formatting rules of the region where the address is located. 38 string formatted_address = 2; 39 40 // The post-processed address represented as a postal address. 41 google.type.PostalAddress postal_address = 3; 42 43 // Unordered list. The individual address components of the formatted and 44 // corrected address, along with validation information. This provides 45 // information on the validation status of the individual components. 46 // 47 // Address components are not ordered in a particular way. Do not make any 48 // assumptions on the ordering of the address components in the list. 49 repeated AddressComponent address_components = 4 50 [(google.api.field_behavior) = UNORDERED_LIST]; 51 52 // The types of components that were expected to be present in a correctly 53 // formatted mailing address but were not found in the input AND could 54 // not be inferred. Components of this type are not present in 55 // `formatted_address`, `postal_address`, or `address_components`. An 56 // example might be `['street_number', 'route']` for an input like 57 // "Boulder, Colorado, 80301, USA". The list of possible types can be found 58 // [here](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). 59 repeated string missing_component_types = 5; 60 61 // The types of the components that are present in the `address_components` 62 // but could not be confirmed to be correct. This field is provided for the 63 // sake of convenience: its contents are equivalent to iterating through the 64 // `address_components` to find the types of all the components where the 65 // [confirmation_level][google.maps.addressvalidation.v1.AddressComponent.confirmation_level] 66 // is not 67 // [CONFIRMED][google.maps.addressvalidation.v1.AddressComponent.ConfirmationLevel.CONFIRMED] 68 // or the 69 // [inferred][google.maps.addressvalidation.v1.AddressComponent.inferred] 70 // flag is not set to `true`. The list of possible types can be found 71 // [here](https://developers.google.com/maps/documentation/geocoding/requests-geocoding#Types). 72 repeated string unconfirmed_component_types = 6; 73 74 // Any tokens in the input that could not be resolved. This might be an 75 // input that was not recognized as a valid part of an address (for example 76 // in an input like "123235253253 Main St, San Francisco, CA, 94105", the 77 // unresolved tokens may look like `["123235253253"]` since that does not 78 // look like a valid street number. 79 repeated string unresolved_tokens = 7; 80} 81 82// Represents an address component, such as a street, city, or state. 83message AddressComponent { 84 // The different possible values for confirmation levels. 85 enum ConfirmationLevel { 86 // Default value. This value is unused. 87 CONFIRMATION_LEVEL_UNSPECIFIED = 0; 88 89 // We were able to verify that this component exists and makes sense in the 90 // context of the rest of the address. 91 CONFIRMED = 1; 92 93 // This component could not be confirmed, but it is plausible that it 94 // exists. For example, a street number within a known valid range of 95 // numbers on a street where specific house numbers are not known. 96 UNCONFIRMED_BUT_PLAUSIBLE = 2; 97 98 // This component was not confirmed and is likely to be wrong. For 99 // example, a neighborhood that does not fit the rest of the address. 100 UNCONFIRMED_AND_SUSPICIOUS = 3; 101 } 102 103 // The name for this component. 104 ComponentName component_name = 1; 105 106 // The type of the address component. See 107 // [Table 2: Additional types returned by the Places 108 // service](https://developers.google.com/places/web-service/supported_types#table2) 109 // for a list of possible types. 110 string component_type = 2; 111 112 // Indicates the level of certainty that we have that the component 113 // is correct. 114 ConfirmationLevel confirmation_level = 3; 115 116 // Indicates that the component was not part of the input, but we 117 // inferred it for the address location and believe it should be provided 118 // for a complete address. 119 bool inferred = 4; 120 121 // Indicates a correction to a misspelling in the component name. The API 122 // does not always flag changes from one spelling variant to another, such as 123 // when changing "centre" to "center". It also does not always flag common 124 // misspellings, such as when changing "Amphitheater Pkwy" to "Amphitheatre 125 // Pkwy". 126 bool spell_corrected = 5; 127 128 // Indicates the name of the component was replaced with a completely 129 // different one, for example a wrong postal code being replaced with one that 130 // is correct for the address. This is not a cosmetic change, the input 131 // component has been changed to a different one. 132 bool replaced = 6; 133 134 // Indicates an address component that is not expected to be present in a 135 // postal address for the given region. We have retained it only because it 136 // was part of the input. 137 bool unexpected = 7; 138} 139 140// A wrapper for the name of the component. 141message ComponentName { 142 // The name text. For example, "5th Avenue" for a street name or "1253" for a 143 // street number. 144 string text = 1; 145 146 // The BCP-47 language code. This will not be present if the component name is 147 // not associated with a language, such as a street number. 148 string language_code = 2; 149} 150