Class v1.MapsPlatformDatasetsClient (2.0.0)

Service definition for the Maps Platform Datasets API. v1

Package

@googlemaps/maps-platform-datasets

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of MapsPlatformDatasetsClient.

Parameters
Name Description
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new MapsPlatformDatasetsClient({fallback: true}, gax); ```

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.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

mapsPlatformDatasetsStub

mapsPlatformDatasetsStub?: Promise<{
        [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.

createDataset(request, options)

createDataset(request?: protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest, options?: CallOptions): Promise<[
        protos.google.maps.mapsplatformdatasets.v1.IDataset,
        (protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest | undefined),
        {} | undefined
    ]>;

Creates a new dataset for the specified project.

Parameters
Name Description
request ICreateDatasetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.maps.mapsplatformdatasets.v1.IDataset, (protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Dataset. Please see the documentation for more details and examples.

Example

  /**
   * 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. Parent project that will own the dataset.
   *  Format: projects/{project}
   */
  // const parent = 'abc123'
  /**
   *  Required. The dataset version to create.
   */
  // const dataset = {}

  // Imports the Mapsplatformdatasets library
  const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1;

  // Instantiates a client
  const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient();

  async function callCreateDataset() {
    // Construct request
    const request = {
      parent,
      dataset,
    };

    // Run request
    const response = await mapsplatformdatasetsClient.createDataset(request);
    console.log(response);
  }

  callCreateDataset();

createDataset(request, options, callback)

createDataset(request: protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest, options: CallOptions, callback: Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateDatasetRequest
options CallOptions
callback Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

createDataset(request, callback)

createDataset(request: protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest, callback: Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateDatasetRequest
callback Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.ICreateDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

datasetPath(project, dataset)

datasetPath(project: string, dataset: string): string;

Return a fully-qualified dataset resource name string.

Parameters
Name Description
project string
dataset string
Returns
Type Description
string

{string} Resource name string.

deleteDataset(request, options)

deleteDataset(request?: protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest | undefined),
        {} | undefined
    ]>;

Deletes the specified dataset.

Parameters
Name Description
request IDeleteDatasetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, (protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. Please see the documentation for more details and examples.

Example

  /**
   * 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 name of the dataset to delete.
   *  Format: projects/{project}/datasets/{dataset_id}
   */
  // const name = 'abc123'

  // Imports the Mapsplatformdatasets library
  const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1;

  // Instantiates a client
  const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient();

  async function callDeleteDataset() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await mapsplatformdatasetsClient.deleteDataset(request);
    console.log(response);
  }

  callDeleteDataset();

deleteDataset(request, options, callback)

deleteDataset(request: protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteDatasetRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

deleteDataset(request, callback)

deleteDataset(request: protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteDatasetRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.maps.mapsplatformdatasets.v1.IDeleteDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getDataset(request, options)

getDataset(request?: protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest, options?: CallOptions): Promise<[
        protos.google.maps.mapsplatformdatasets.v1.IDataset,
        protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest | undefined,
        {} | undefined
    ]>;

Gets the dataset.

Parameters
Name Description
request IGetDatasetRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Dataset. Please see the documentation for more details and examples.

Example

  /**
   * 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. Resource name.
   *  Format: projects/{project}/datasets/{dataset_id}
   *  Can also fetch some special versions by appending "@" and a tag.
   *  Format: projects/{project}/datasets/{dataset_id}@{tag}
   *  Tag "active": The info of the latest completed version will be included,
   *  and NOT_FOUND if the dataset does not have one.
   */
  // const name = 'abc123'

  // Imports the Mapsplatformdatasets library
  const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1;

  // Instantiates a client
  const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient();

  async function callGetDataset() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await mapsplatformdatasetsClient.getDataset(request);
    console.log(response);
  }

  callGetDataset();

getDataset(request, options, callback)

getDataset(request: protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest, options: CallOptions, callback: Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetDatasetRequest
options CallOptions
callback Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getDataset(request, callback)

getDataset(request: protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest, callback: Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetDatasetRequest
callback Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.IGetDatasetRequest | 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.

listDatasets(request, options)

listDatasets(request?: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, options?: CallOptions): Promise<[
        protos.google.maps.mapsplatformdatasets.v1.IDataset[],
        protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest | null,
        protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse
    ]>;

Lists all the datasets for the specified project.

Parameters
Name Description
request IListDatasetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.maps.mapsplatformdatasets.v1.IDataset[], protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest | null, protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of Dataset. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listDatasetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listDatasets(request, options, callback)

listDatasets(request: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, options: CallOptions, callback: PaginationCallback<protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse | null | undefined, protos.google.maps.mapsplatformdatasets.v1.IDataset>): void;
Parameters
Name Description
request IListDatasetsRequest
options CallOptions
callback PaginationCallback<protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse | null | undefined, protos.google.maps.mapsplatformdatasets.v1.IDataset>
Returns
Type Description
void

listDatasets(request, callback)

listDatasets(request: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, callback: PaginationCallback<protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse | null | undefined, protos.google.maps.mapsplatformdatasets.v1.IDataset>): void;
Parameters
Name Description
request IListDatasetsRequest
callback PaginationCallback<protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, protos.google.maps.mapsplatformdatasets.v1.IListDatasetsResponse | null | undefined, protos.google.maps.mapsplatformdatasets.v1.IDataset>
Returns
Type Description
void

listDatasetsAsync(request, options)

listDatasetsAsync(request?: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, options?: CallOptions): AsyncIterable<protos.google.maps.mapsplatformdatasets.v1.IDataset>;

Equivalent to listDatasets, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
Name Description
request IListDatasetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.maps.mapsplatformdatasets.v1.IDataset>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing Dataset. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * 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 name of the project to list all the datasets for.
   *  Format: projects/{project}
   */
  // const parent = 'abc123'
  /**
   *  The maximum number of datasets to return per page.
   *  If unspecified (or zero), all datasets will be returned.
   */
  // const pageSize = 1234
  /**
   *  The page token, received from a previous ListDatasets call.
   *  Provide this to retrieve the subsequent page.
   */
  // const pageToken = 'abc123'
  /**
   *  The tag that specifies the desired version for each dataset.
   *  Note that when pagination is also specified, some filtering can happen
   *  after pagination, which may cause the response to contain fewer datasets
   *  than the page size, even if it's not the last page.
   *  Tag "active": Each dataset in the response will include the info of its
   *  latest completed version, and the dataset will be skipped if it does not
   *  have one.
   */
  // const tag = 'abc123'

  // Imports the Mapsplatformdatasets library
  const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1;

  // Instantiates a client
  const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient();

  async function callListDatasets() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = mapsplatformdatasetsClient.listDatasetsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListDatasets();

listDatasetsStream(request, options)

listDatasetsStream(request?: protos.google.maps.mapsplatformdatasets.v1.IListDatasetsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
Name Description
request IListDatasetsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing Dataset on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listDatasetsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

matchDatasetFromDatasetName(datasetName)

matchDatasetFromDatasetName(datasetName: string): string | number;

Parse the dataset from Dataset resource.

Parameter
Name Description
datasetName string

A fully-qualified path representing Dataset resource.

Returns
Type Description
string | number

{string} A string representing the dataset.

matchProjectFromDatasetName(datasetName)

matchProjectFromDatasetName(datasetName: string): string | number;

Parse the project from Dataset resource.

Parameter
Name Description
datasetName string

A fully-qualified path representing Dataset resource.

Returns
Type Description
string | number

{string} A string representing the project.

updateDatasetMetadata(request, options)

updateDatasetMetadata(request?: protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest, options?: CallOptions): Promise<[
        protos.google.maps.mapsplatformdatasets.v1.IDataset,
        (protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest | undefined),
        {} | undefined
    ]>;

Updates the metadata for the dataset.

Parameters
Name Description
request IUpdateDatasetMetadataRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.maps.mapsplatformdatasets.v1.IDataset, (protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Dataset. Please see the documentation for more details and examples.

Example

  /**
   * 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. Resource name of the dataset to update.
   *  Format: projects/{project}/datasets/{dataset_id}
   */
  // const dataset = {}
  /**
   *  The list of fields to be updated.
   *  The value "*" is used for full replacement (default).
   */
  // const updateMask = {}

  // Imports the Mapsplatformdatasets library
  const {MapsPlatformDatasetsClient} = require('@googlemaps/maps-platform-datasets').v1;

  // Instantiates a client
  const mapsplatformdatasetsClient = new MapsPlatformDatasetsClient();

  async function callUpdateDatasetMetadata() {
    // Construct request
    const request = {
      dataset,
    };

    // Run request
    const response = await mapsplatformdatasetsClient.updateDatasetMetadata(request);
    console.log(response);
  }

  callUpdateDatasetMetadata();

updateDatasetMetadata(request, options, callback)

updateDatasetMetadata(request: protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest, options: CallOptions, callback: Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateDatasetMetadataRequest
options CallOptions
callback Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

updateDatasetMetadata(request, callback)

updateDatasetMetadata(request: protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest, callback: Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IUpdateDatasetMetadataRequest
callback Callback<protos.google.maps.mapsplatformdatasets.v1.IDataset, protos.google.maps.mapsplatformdatasets.v1.IUpdateDatasetMetadataRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void