The service for validating addresses. v1
Package
@googlemaps/addressvalidationConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of AddressValidationClient.
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof gax.fallback
: loaded instance of |
Properties
addressValidationStub
addressValidationStub?: Promise<{
[name: string]: Function;
}>;
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath(), exists for compatibility reasons.
auth
auth: gax.GoogleAuth;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
port
static get port(): number;
The port for this API service.
scopes
static get scopes(): never[];
The scopes needed to make gRPC calls for every method defined in this service.
servicePath
static get servicePath(): string;
The DNS address for this API service.
warn
warn: (code: string, message: string, warnType?: string) => void;
Methods
close()
close(): Promise<void>;
Terminate the gRPC channel and close the client.
The client will no longer be usable and all future behavior is undefined.
Type | Description |
Promise<void> | {Promise} A promise that resolves when the client is closed. |
getProjectId()
getProjectId(): Promise<string>;
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Type | Description |
void |
initialize()
initialize(): Promise<{
[name: string]: Function;
}>;
Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.
You can await on this method if you want to make sure the client is initialized.
Type | Description |
Promise<{ [name: string]: Function; }> | {Promise} A promise that resolves to an authenticated service stub. |
provideValidationFeedback(request, options)
provideValidationFeedback(request?: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest, options?: CallOptions): Promise<[
protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse,
(protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest | undefined),
{} | undefined
]>;
Feedback about the outcome of the sequence of validation attempts. This should be the last call made after a sequence of validation calls for the same address, and should be called once the transaction is concluded. This should only be sent once for the sequence of ValidateAddress
requests needed to validate an address fully.
Name | Description |
request |
protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[ protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, (protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest | undefined), {} | undefined ]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [ProvideValidationFeedbackResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The outcome of the sequence of validation attempts.
* If this field is set to `VALIDATION_CONCLUSION_UNSPECIFIED`, an
* `INVALID_ARGUMENT` error will be returned.
*/
// const conclusion = {}
/**
* Required. The ID of the response that this feedback is for. This should be the
* response_id google.maps.addressvalidation.v1.ValidateAddressRequest.response_id
* from the first response in a series of address validation attempts.
*/
// const responseId = 'abc123'
// Imports the Addressvalidation library
const {AddressValidationClient} = require('@googlemaps/addressvalidation').v1;
// Instantiates a client
const addressvalidationClient = new AddressValidationClient();
async function callProvideValidationFeedback() {
// Construct request
const request = {
conclusion,
responseId,
};
// Run request
const response = await addressvalidationClient.provideValidationFeedback(request);
console.log(response);
}
callProvideValidationFeedback();
provideValidationFeedback(request, options, callback)
provideValidationFeedback(request: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest, options: CallOptions, callback: Callback<protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
provideValidationFeedback(request, callback)
provideValidationFeedback(request: protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest, callback: Callback<protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest
|
callback |
Callback<protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackResponse, protos.google.maps.addressvalidation.v1.IProvideValidationFeedbackRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
validateAddress(request, options)
validateAddress(request?: protos.google.maps.addressvalidation.v1.IValidateAddressRequest, options?: CallOptions): Promise<[
protos.google.maps.addressvalidation.v1.IValidateAddressResponse,
(protos.google.maps.addressvalidation.v1.IValidateAddressRequest | undefined),
{} | undefined
]>;
Validates an address.
Name | Description |
request |
protos.google.maps.addressvalidation.v1.IValidateAddressRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Type | Description |
Promise<[ protos.google.maps.addressvalidation.v1.IValidateAddressResponse, (protos.google.maps.addressvalidation.v1.IValidateAddressRequest | undefined), {} | undefined ]> | {Promise} - The promise which resolves to an array. The first element of the array is an object representing [ValidateAddressResponse]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples. |
/**
* This snippet has been automatically generated and should be regarded as a code template only.
* It will require modifications to work.
* It may require correct/in-range values for request initialization.
* TODO(developer): Uncomment these variables before running the sample.
*/
/**
* Required. The address being validated. Unformatted addresses should be
* submitted via `address_lines` google.type.PostalAddress.address_lines.
* The total length of the fields in this input must not exceed 300
* characters.
* Supported regions can be found in the
* FAQ (https://developers.google.com/maps/documentation/address-validation/faq#which_regions_are_currently_supported).
* The language_code google.type.PostalAddress.language_code value in the
* input address is reserved for future uses and is ignored today. The
* validated address result will be populated based on the preferred language
* for the given address, as identified by the system.
* The Address Validation API ignores the values in
* recipients google.type.PostalAddress.recipients and
* organization google.type.PostalAddress.organization. Any values in those
* fields will be discarded and not returned. Please do not set them.
*/
// const address = {}
/**
* This field must be empty for the first address validation request. If
* more requests are necessary to fully validate a single address (for
* example if the changes the user makes after the initial validation need to
* be re-validated), then each followup request must populate this field with
* the
* response_id google.maps.addressvalidation.v1.ValidateAddressResponse.response_id
* from the very first response in the validation sequence.
*/
// const previousResponseId = 'abc123'
/**
* Enables USPS CASS compatible mode. This affects _only_ the
* google.maps.addressvalidation.v1.ValidationResult.usps_data field of
* google.maps.addressvalidation.v1.ValidationResult. Note: for USPS CASS
* enabled requests for addresses in Puerto Rico, a
* google.type.PostalAddress.region_code of the `address` must be provided
* as "PR", or an google.type.PostalAddress.administrative_area of the
* `address` must be provided as "Puerto Rico" (case-insensitive) or "PR".
* It's recommended to use a componentized `address`, or alternatively specify
* at least two google.type.PostalAddress.address_lines where the first line
* contains the street number and name and the second line contains the city,
* state, and zip code.
*/
// const enableUspsCass = true
// Imports the Addressvalidation library
const {AddressValidationClient} = require('@googlemaps/addressvalidation').v1;
// Instantiates a client
const addressvalidationClient = new AddressValidationClient();
async function callValidateAddress() {
// Construct request
const request = {
address,
};
// Run request
const response = await addressvalidationClient.validateAddress(request);
console.log(response);
}
callValidateAddress();
validateAddress(request, options, callback)
validateAddress(request: protos.google.maps.addressvalidation.v1.IValidateAddressRequest, options: CallOptions, callback: Callback<protos.google.maps.addressvalidation.v1.IValidateAddressResponse, protos.google.maps.addressvalidation.v1.IValidateAddressRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.maps.addressvalidation.v1.IValidateAddressRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.maps.addressvalidation.v1.IValidateAddressResponse, protos.google.maps.addressvalidation.v1.IValidateAddressRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |
validateAddress(request, callback)
validateAddress(request: protos.google.maps.addressvalidation.v1.IValidateAddressRequest, callback: Callback<protos.google.maps.addressvalidation.v1.IValidateAddressResponse, protos.google.maps.addressvalidation.v1.IValidateAddressRequest | null | undefined, {} | null | undefined>): void;
Name | Description |
request |
protos.google.maps.addressvalidation.v1.IValidateAddressRequest
|
callback |
Callback<protos.google.maps.addressvalidation.v1.IValidateAddressResponse, protos.google.maps.addressvalidation.v1.IValidateAddressRequest | null | undefined, {} | null | undefined>
|
Type | Description |
void |