Skip to content

Commit 5ff3e52

Browse files
Google APIscopybara-github
authored andcommitted
feat: add session token support for Autocomplete (New) sessions that end with a call to Address Validation
feat: add new fields to USPS data docs: update proto field descriptions PiperOrigin-RevId: 608369029
1 parent d89f84a commit 5ff3e52

4 files changed

Lines changed: 130 additions & 17 deletions

File tree

google/maps/addressvalidation/v1/address.proto

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ message AddressComponent {
118118
// for a complete address.
119119
bool inferred = 4;
120120

121-
// Indicates the spelling of the component name was corrected in a minor way,
122-
// for example by switching two characters that appeared in the wrong order.
123-
// This indicates a cosmetic change.
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".
124126
bool spell_corrected = 5;
125127

126128
// Indicates the name of the component was replaced with a completely

google/maps/addressvalidation/v1/address_validation_service.proto

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ message ValidateAddressRequest {
7070
// The total length of the fields in this input must not exceed 280
7171
// characters.
7272
//
73-
// Supported regions can be found in the
74-
// [FAQ](https://developers.google.com/maps/documentation/address-validation/faq#which_regions_are_currently_supported).
73+
// Supported regions can be found
74+
// [here](https://developers.google.com/maps/documentation/address-validation/coverage).
7575
//
7676
// The [language_code][google.type.PostalAddress.language_code] value in the
7777
// input address is reserved for future uses and is ignored today. The
@@ -107,6 +107,28 @@ message ValidateAddressRequest {
107107
// contains the street number and name and the second line contains the city,
108108
// state, and zip code.
109109
bool enable_usps_cass = 3;
110+
111+
// Optional. A string which identifies an Autocomplete session for billing
112+
// purposes. Must be a URL and filename safe base64 string with at most 36
113+
// ASCII characters in length. Otherwise an INVALID_ARGUMENT error is
114+
// returned.
115+
//
116+
// The session begins when the user starts typing a query, and concludes when
117+
// they select a place and a call to Place Details or Address Validation is
118+
// made. Each session can have multiple autocomplete queries, followed by one
119+
// Place Details or Address Validation request. The credentials used for each
120+
// request within a session must belong to the same Google Cloud Console
121+
// project. Once a session has concluded, the token is no longer valid; your
122+
// app must generate a fresh token for each session. If the `session_token`
123+
// parameter is omitted, or if you reuse a session token, the session is
124+
// charged as if no session token was provided (each request is billed
125+
// separately).
126+
//
127+
// Note: Address Validation can only be used in sessions with the
128+
// Autocomplete (New) API, not the old Autocomplete API. See
129+
// https://developers.google.com/maps/documentation/places/web-service/session-pricing
130+
// for more details.
131+
string session_token = 5 [(google.api.field_behavior) = OPTIONAL];
110132
}
111133

112134
// The response to an address validation request.
@@ -204,8 +226,7 @@ message Verdict {
204226
// Building-level result.
205227
PREMISE = 2;
206228

207-
// A geocode that should be very close to the building-level location of
208-
// the address.
229+
// A geocode that approximates the building-level location of the address.
209230
PREMISE_PROXIMITY = 3;
210231

211232
// The address or geocode indicates a block. Only used in regions which

google/maps/addressvalidation/v1/addressvalidation_v1.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,4 @@ documentation:
1212
addresses. Given an address, it returns information about the correctness
1313
of the components of the parsed address, a geocode, and a verdict on the
1414
deliverability of the parsed address.
15-
overview: |-
16-
The Address Validation API allows developers to validate an address and
17-
its components, standardize the address for mailing, and determine the
18-
best known geocode for it.
15+
overview: '<!--#include file="/geo/platform/address_validation/g3doc/overview.md"-->'

google/maps/addressvalidation/v1/usps_data.proto

Lines changed: 99 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,18 @@ message UspsData {
7373
// code, and ZIP+4 together should yield a number divisible by 10.
7474
string delivery_point_check_digit = 3;
7575

76-
// The possible values for DPV confirmation. Returns a single character.
76+
// The possible values for DPV confirmation. Returns a single character or
77+
// returns no value.
7778
//
78-
// * `Y`: Address was DPV confirmed for primary and any secondary numbers.
7979
// * `N`: Primary and any secondary number information failed to
8080
// DPV confirm.
81-
// * `S`: Address was DPV confirmed for the primary number only, and the
82-
// secondary number information was present by not confirmed.
8381
// * `D`: Address was DPV confirmed for the primary number only, and the
8482
// secondary number information was missing.
83+
// * `S`: Address was DPV confirmed for the primary number only, and the
84+
// secondary number information was present but not confirmed.
85+
// * `Y`: Address was DPV confirmed for primary and any secondary numbers.
86+
// * Empty: If the response does not contain a `dpv_confirmation` value, the
87+
// address was not submitted for DPV confirmation.
8588
string dpv_confirmation = 4;
8689

8790
// The footnotes from delivery point validation.
@@ -90,11 +93,12 @@ message UspsData {
9093
// * `AA`: Input address matched to the ZIP+4 file
9194
// * `A1`: Input address was not matched to the ZIP+4 file
9295
// * `BB`: Matched to DPV (all components)
93-
// * `CC`: Secondary number not matched (present but invalid)
96+
// * `CC`: Secondary number not matched and not required
97+
// * `C1`: Secondary number not matched but required
9498
// * `N1`: High-rise address missing secondary number
9599
// * `M1`: Primary number missing
96100
// * `M3`: Primary number invalid
97-
// * `P1`: Input address RR or HC box number missing
101+
// * `P1`: Input address PO, RR or HC box number missing
98102
// * `P3`: Input address PO, RR, or HC Box number invalid
99103
// * `F1`: Input address matched to a military address
100104
// * `G1`: Input address matched to a general delivery address
@@ -103,6 +107,8 @@ message UspsData {
103107
// * `RR`: DPV confirmed address with PMB information
104108
// * `R1`: DPV confirmed address without PMB information
105109
// * `R7`: Carrier Route R777 or R779 record
110+
// * `IA`: Informed Address identified
111+
// * `TA`: Primary number matched by dropping a trailing alpha
106112
string dpv_footnote = 5;
107113

108114
// Indicates if the address is a CMRA (Commercial Mail Receiving Agency)--a
@@ -127,6 +133,93 @@ message UspsData {
127133
// * `N`: The address is active
128134
string dpv_no_stat = 8;
129135

136+
// Indicates the NoStat type. Returns a reason code as int.
137+
//
138+
// * `1`: IDA (Internal Drop Address) – Addresses that do not receive mail
139+
// directly from the USPS but are delivered to a drop address that services
140+
// them.
141+
// * `2`: CDS - Addresses that have not yet become deliverable. For example, a
142+
// new subdivision where lots and primary numbers have been determined, but no
143+
// structure exists yet for occupancy.
144+
// * `3`: Collision - Addresses that do not actually DPV confirm.
145+
// * `4`: CMZ (College, Military and Other Types) - ZIP + 4 records USPS has
146+
// incorporated into the data.
147+
// * `5`: Regular - Indicates addresses not receiving delivery and the
148+
// addresses are not counted as possible deliveries.
149+
// * `6`: Secondary Required - The address requires secondary information.
150+
int32 dpv_no_stat_reason_code = 29;
151+
152+
// Flag indicates mail is delivered to a single receptable at a site.
153+
// Returns a single character.
154+
//
155+
// * `Y`: The mail is delivered to a single receptable at a site.
156+
// * `N`: The mail is not delivered to a single receptable at a site.
157+
string dpv_drop = 30;
158+
159+
// Indicates that mail is not delivered to the street address.
160+
// Returns a single character.
161+
//
162+
// * `Y`: The mail is not delivered to the street address.
163+
// * `N`: The mail is delivered to the street address.
164+
string dpv_throwback = 31;
165+
166+
// Flag indicates mail delivery is not performed every day of the week.
167+
// Returns a single character.
168+
//
169+
// * `Y`: The mail delivery is not performed every day of the week.
170+
// * `N`: No indication the mail delivery is not performed every day of the
171+
// week.
172+
string dpv_non_delivery_days = 32;
173+
174+
// Integer identifying non-delivery days. It can be interrogated using bit
175+
// flags:
176+
// 0x40 – Sunday is a non-delivery day
177+
// 0x20 – Monday is a non-delivery day
178+
// 0x10 – Tuesday is a non-delivery day
179+
// 0x08 – Wednesday is a non-delivery day
180+
// 0x04 – Thursday is a non-delivery day
181+
// 0x02 – Friday is a non-delivery day
182+
// 0x01 – Saturday is a non-delivery day
183+
int32 dpv_non_delivery_days_values = 33;
184+
185+
// Flag indicates door is accessible, but package will not be left due to
186+
// security concerns.
187+
// Returns a single character.
188+
//
189+
// * `Y`: The package will not be left due to security concerns.
190+
// * `N`: No indication the package will not be left due to security concerns.
191+
string dpv_no_secure_location = 34;
192+
193+
// Indicates the address was matched to PBSA record.
194+
// Returns a single character.
195+
//
196+
// * `Y`: The address was matched to PBSA record.
197+
// * `N`: The address was not matched to PBSA record.
198+
string dpv_pbsa = 35;
199+
200+
// Flag indicates addresses where USPS cannot knock on a door to deliver mail.
201+
// Returns a single character.
202+
//
203+
// * `Y`: The door is not accessible.
204+
// * `N`: No indication the door is not accessible.
205+
string dpv_door_not_accessible = 36;
206+
207+
// Indicates that more than one DPV return code is valid for the address.
208+
// Returns a single character.
209+
//
210+
// * `Y`: Address was DPV confirmed for primary and any secondary numbers.
211+
// * `N`: Primary and any secondary number information failed to
212+
// DPV confirm.
213+
// * `S`: Address was DPV confirmed for the primary number only, and the
214+
// secondary number information was present by not confirmed, or a single
215+
// trailing alpha on a primary number was dropped to make a DPV match and
216+
// secondary information required.
217+
// * `D`: Address was DPV confirmed for the primary number only, and the
218+
// secondary number information was missing.
219+
// * `R`: Address confirmed but assigned to phantom route R777 and R779 and
220+
// USPS delivery is not provided.
221+
string dpv_enhanced_delivery_code = 37;
222+
130223
// The carrier route code.
131224
// A four character code consisting of a one letter prefix and a three digit
132225
// route designator.

0 commit comments

Comments
 (0)