Service definition for the Places Insights API. v1
Package
@googlemaps/areainsightsConstructors
(constructor)(opts, gaxInstance)
constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);
Construct an instance of AreaInsightsClient.
Parameters | |
---|---|
Name | Description |
opts |
ClientOptions
|
gaxInstance |
typeof gax | typeof fallback
: loaded instance of |
Properties
apiEndpoint
get apiEndpoint(): string;
The DNS address for this API service.
apiEndpoint
static get apiEndpoint(): string;
The DNS address for this API service - same as servicePath.
areaInsightsStub
areaInsightsStub?: Promise<{
[name: string]: Function;
}>;
auth
auth: gax.GoogleAuth;
descriptors
descriptors: Descriptors;
innerApiCalls
innerApiCalls: {
[name: string]: Function;
};
pathTemplates
pathTemplates: {
[name: string]: gax.PathTemplate;
};
port
static get port(): number;
The port for this API service.
scopes
static get scopes(): string[];
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.
universeDomain
get universeDomain(): string;
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.
Returns | |
---|---|
Type | Description |
Promise<void> |
{Promise} A promise that resolves when the client is closed. |
computeInsights(request, options)
computeInsights(request?: protos.google.maps.areainsights.v1.IComputeInsightsRequest, options?: CallOptions): Promise<[
protos.google.maps.areainsights.v1.IComputeInsightsResponse,
protos.google.maps.areainsights.v1.IComputeInsightsRequest | undefined,
{} | undefined
]>;
Compute Insights RPC
This method lets you retrieve insights about areas using a variaty of filter such as: area, place type, operating status, price level and ratings. Currently "count" and "places" insights are supported. With "count" insights you can answer questions such as "How many restaurant are located in California that are operational, are inexpensive and have an average rating of at least 4 stars" (see insight
enum for more details). With "places" insights, you can determine which places match the requested filter. Clients can then use those place resource names to fetch more details about each individual place using the Places API.
Parameters | |
---|---|
Name | Description |
request |
IComputeInsightsRequest
The request object that will be sent. |
options |
CallOptions
Call options. See CallOptions for more details. |
Returns | |
---|---|
Type | Description |
Promise<[
protos.google.maps.areainsights.v1.IComputeInsightsResponse,
protos.google.maps.areainsights.v1.IComputeInsightsRequest | undefined,
{} | undefined
]> |
{Promise} - The promise which resolves to an array. The first element of the array is an object representing ComputeInsightsResponse. Please see the documentation 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. Insights to compute. Currently only INSIGHT_COUNT and
* INSIGHT_PLACES are supported.
*/
// const insights = [1,2,3,4]
/**
* Required. Insight filter.
*/
// const filter = {}
// Imports the Areainsights library
const {AreaInsightsClient} = require('@googlemaps/areainsights').v1;
// Instantiates a client
const areainsightsClient = new AreaInsightsClient();
async function callComputeInsights() {
// Construct request
const request = {
insights,
filter,
};
// Run request
const response = await areainsightsClient.computeInsights(request);
console.log(response);
}
callComputeInsights();
computeInsights(request, options, callback)
computeInsights(request: protos.google.maps.areainsights.v1.IComputeInsightsRequest, options: CallOptions, callback: Callback<protos.google.maps.areainsights.v1.IComputeInsightsResponse, protos.google.maps.areainsights.v1.IComputeInsightsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IComputeInsightsRequest
|
options |
CallOptions
|
callback |
Callback<protos.google.maps.areainsights.v1.IComputeInsightsResponse, protos.google.maps.areainsights.v1.IComputeInsightsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
computeInsights(request, callback)
computeInsights(request: protos.google.maps.areainsights.v1.IComputeInsightsRequest, callback: Callback<protos.google.maps.areainsights.v1.IComputeInsightsResponse, protos.google.maps.areainsights.v1.IComputeInsightsRequest | null | undefined, {} | null | undefined>): void;
Parameters | |
---|---|
Name | Description |
request |
IComputeInsightsRequest
|
callback |
Callback<protos.google.maps.areainsights.v1.IComputeInsightsResponse, protos.google.maps.areainsights.v1.IComputeInsightsRequest | null | undefined, {} | null | undefined>
|
Returns | |
---|---|
Type | Description |
void |
getProjectId()
getProjectId(): Promise<string>;
Returns | |
---|---|
Type | Description |
Promise<string> |
getProjectId(callback)
getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter | |
---|---|
Name | Description |
callback |
Callback<string, undefined, undefined>
|
Returns | |
---|---|
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.
Returns | |
---|---|
Type | Description |
Promise<{
[name: string]: Function;
}> |
{Promise} A promise that resolves to an authenticated service stub. |
matchPlaceIdFromPlaceName(placeName)
matchPlaceIdFromPlaceName(placeName: string): string | number;
Parse the place_id from Place resource.
Parameter | |
---|---|
Name | Description |
placeName |
string
A fully-qualified path representing Place resource. |
Returns | |
---|---|
Type | Description |
string | number |
{string} A string representing the place_id. |
placePath(placeId)
placePath(placeId: string): string;
Return a fully-qualified place resource name string.
Parameter | |
---|---|
Name | Description |
placeId |
string
|
Returns | |
---|---|
Type | Description |
string |
{string} Resource name string. |