Class v2.UserEventServiceClient

Service for ingesting end user actions on the customer website. v2

Package

@google-cloud/retail

Constructors

(constructor)(opts)

constructor(opts?: ClientOptions);

Construct an instance of UserEventServiceClient.

Parameter
NameDescription
opts ClientOptions

Properties

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;
    };

operationsClient

operationsClient: gax.OperationsClient;

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.

userEventServiceStub

userEventServiceStub?: Promise<{
        [name: string]: Function;
    }>;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

catalogPath(project, location, catalog)

catalogPath(project: string, location: string, catalog: string): string;

Return a fully-qualified catalog resource name string.

Parameters
NameDescription
project string
location string
catalog string
Returns
TypeDescription
string

{string} Resource name string.

checkImportUserEventsProgress(name)

checkImportUserEventsProgress(name: string): Promise<LROperation<protos.google.cloud.retail.v2.ImportUserEventsResponse, protos.google.cloud.retail.v2.ImportMetadata>>;

Check the status of the long running operation returned by importUserEvents().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.retail.v2.ImportUserEventsResponse, protos.google.cloud.retail.v2.ImportMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. `projects/1234/locations/global/catalogs/default_catalog`
   */
  // const parent = 'abc123'
  /**
   *  Required. The desired input location of the data.
   */
  // const inputConfig = {}
  /**
   *  The desired location of errors incurred during the Import. Cannot be set
   *  for inline user event imports.
   */
  // const errorsConfig = {}

  // Imports the Retail library
  const {UserEventServiceClient} = require('@google-cloud/retail').v2;

  // Instantiates a client
  const retailClient = new UserEventServiceClient();

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

    // Run request
    const [operation] = await retailClient.importUserEvents(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callImportUserEvents();

checkPurgeUserEventsProgress(name)

checkPurgeUserEventsProgress(name: string): Promise<LROperation<protos.google.cloud.retail.v2.PurgeUserEventsResponse, protos.google.cloud.retail.v2.PurgeMetadata>>;

Check the status of the long running operation returned by purgeUserEvents().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.retail.v2.PurgeUserEventsResponse, protos.google.cloud.retail.v2.PurgeMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the catalog under which the events are
   *  created. The format is
   *  `projects/${projectId}/locations/global/catalogs/${catalogId}`
   */
  // const parent = 'abc123'
  /**
   *  Required. The filter string to specify the events to be deleted with a
   *  length limit of 5,000 characters. Empty string filter is not allowed. The
   *  eligible fields for filtering are:
   *  * `eventType`: Double quoted
   *  UserEvent.event_type google.cloud.retail.v2.UserEvent.event_type  string.
   *  * `eventTime`: in ISO 8601 "zulu" format.
   *  * `visitorId`: Double quoted string. Specifying this will delete all
   *    events associated with a visitor.
   *  * `userId`: Double quoted string. Specifying this will delete all events
   *    associated with a user.
   *  Examples:
   *  * Deleting all events in a time range:
   *    `eventTime > "2012-04-23T18:25:43.511Z"
   *    eventTime < "2012-04-23t18:30:43.511z"`="" *="" *="" deleting="" specific="" eventtype="" in="" time="" range:="" *="" `eventtime=""> "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
   *  * Deleting all events for a specific visitor:
   *    `visitorId = "visitor1024"`
   *  The filtering fields are assumed to have an implicit AND.
   */
  // const filter = 'abc123'
  /**
   *  Actually perform the purge.
   *  If `force` is set to false, the method will return the expected purge count
   *  without deleting any user events.
   */
  // const force = true

  // Imports the Retail library
  const {UserEventServiceClient} = require('@google-cloud/retail').v2;

  // Instantiates a client
  const retailClient = new UserEventServiceClient();

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

    // Run request
    const [operation] = await retailClient.purgeUserEvents(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callPurgeUserEvents();

checkRejoinUserEventsProgress(name)

checkRejoinUserEventsProgress(name: string): Promise<LROperation<protos.google.cloud.retail.v2.RejoinUserEventsResponse, protos.google.cloud.retail.v2.RejoinUserEventsMetadata>>;

Check the status of the long running operation returned by rejoinUserEvents().

Parameter
NameDescription
name string

The operation name that will be passed.

Returns
TypeDescription
Promise<LROperation<protos.google.cloud.retail.v2.RejoinUserEventsResponse, protos.google.cloud.retail.v2.RejoinUserEventsMetadata>>

{Promise} - The promise which resolves to an object. The decoded operation object has result and metadata field to get information from. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent catalog resource name, such as
   *  `projects/1234/locations/global/catalogs/default_catalog`.
   */
  // const parent = 'abc123'
  /**
   *  The type of the user event rejoin to define the scope and range of the user
   *  events to be rejoined with the latest product catalog. Defaults to
   *  USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
   *  invalid integer value.
   */
  // const userEventRejoinScope = {}

  // Imports the Retail library
  const {UserEventServiceClient} = require('@google-cloud/retail').v2;

  // Instantiates a client
  const retailClient = new UserEventServiceClient();

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

    // Run request
    const [operation] = await retailClient.rejoinUserEvents(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callRejoinUserEvents();

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
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

collectUserEvent(request, options)

collectUserEvent(request?: protos.google.cloud.retail.v2.ICollectUserEventRequest, options?: CallOptions): Promise<[
        protos.google.api.IHttpBody,
        protos.google.cloud.retail.v2.ICollectUserEventRequest | undefined,
        {} | undefined
    ]>;

Writes a single user event from the browser. This uses a GET request to due to browser restriction of POST-ing to a 3rd party domain.

This method is used only by the Retail API JavaScript pixel and Google Tag Manager. Users should not call this method directly.

Parameters
NameDescription
request protos.google.cloud.retail.v2.ICollectUserEventRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.api.IHttpBody, protos.google.cloud.retail.v2.ICollectUserEventRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [HttpBody]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent catalog name, such as
   *  `projects/1234/locations/global/catalogs/default_catalog`.
   */
  // const parent = 'abc123'
  /**
   *  Required. URL encoded UserEvent proto with a length limit of 2,000,000
   *  characters.
   */
  // const userEvent = 'abc123'
  /**
   *  The URL including cgi-parameters but excluding the hash fragment with a
   *  length limit of 5,000 characters. This is often more useful than the
   *  referer URL, because many browsers only send the domain for 3rd party
   *  requests.
   */
  // const uri = 'abc123'
  /**
   *  The event timestamp in milliseconds. This prevents browser caching of
   *  otherwise identical get requests. The name is abbreviated to reduce the
   *  payload bytes.
   */
  // const ets = 1234

  // Imports the Retail library
  const {UserEventServiceClient} = require('@google-cloud/retail').v2;

  // Instantiates a client
  const retailClient = new UserEventServiceClient();

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

    // Run request
    const response = await retailClient.collectUserEvent(request);
    console.log(response);
  }

  callCollectUserEvent();

collectUserEvent(request, options, callback)

collectUserEvent(request: protos.google.cloud.retail.v2.ICollectUserEventRequest, options: CallOptions, callback: Callback<protos.google.api.IHttpBody, protos.google.cloud.retail.v2.ICollectUserEventRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.retail.v2.ICollectUserEventRequest
options CallOptions
callback Callback<protos.google.api.IHttpBody, protos.google.cloud.retail.v2.ICollectUserEventRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

collectUserEvent(request, callback)

collectUserEvent(request: protos.google.cloud.retail.v2.ICollectUserEventRequest, callback: Callback<protos.google.api.IHttpBody, protos.google.cloud.retail.v2.ICollectUserEventRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.retail.v2.ICollectUserEventRequest
callback Callback<protos.google.api.IHttpBody, protos.google.cloud.retail.v2.ICollectUserEventRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

importUserEvents(request, options)

importUserEvents(request?: protos.google.cloud.retail.v2.IImportUserEventsRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.retail.v2.IImportUserEventsResponse, protos.google.cloud.retail.v2.IImportMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Bulk import of User events. Request processing might be synchronous. Events that already exist are skipped. Use this method for backfilling historical user events.

Operation.response is of type ImportResponse. Note that it is possible for a subset of the items to be successfully inserted. Operation.metadata is of type ImportMetadata.

Parameters
NameDescription
request protos.google.cloud.retail.v2.IImportUserEventsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.retail.v2.IImportUserEventsResponse, protos.google.cloud.retail.v2.IImportMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. `projects/1234/locations/global/catalogs/default_catalog`
   */
  // const parent = 'abc123'
  /**
   *  Required. The desired input location of the data.
   */
  // const inputConfig = {}
  /**
   *  The desired location of errors incurred during the Import. Cannot be set
   *  for inline user event imports.
   */
  // const errorsConfig = {}

  // Imports the Retail library
  const {UserEventServiceClient} = require('@google-cloud/retail').v2;

  // Instantiates a client
  const retailClient = new UserEventServiceClient();

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

    // Run request
    const [operation] = await retailClient.importUserEvents(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callImportUserEvents();

importUserEvents(request, options, callback)

importUserEvents(request: protos.google.cloud.retail.v2.IImportUserEventsRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.retail.v2.IImportUserEventsResponse, protos.google.cloud.retail.v2.IImportMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.retail.v2.IImportUserEventsRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.retail.v2.IImportUserEventsResponse, protos.google.cloud.retail.v2.IImportMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

importUserEvents(request, callback)

importUserEvents(request: protos.google.cloud.retail.v2.IImportUserEventsRequest, callback: Callback<LROperation<protos.google.cloud.retail.v2.IImportUserEventsResponse, protos.google.cloud.retail.v2.IImportMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.retail.v2.IImportUserEventsRequest
callback Callback<LROperation<protos.google.cloud.retail.v2.IImportUserEventsResponse, protos.google.cloud.retail.v2.IImportMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
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
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

matchBranchFromProductName(productName)

matchBranchFromProductName(productName: string): string | number;

Parse the branch from Product resource.

Parameter
NameDescription
productName string

A fully-qualified path representing Product resource.

Returns
TypeDescription
string | number

{string} A string representing the branch.

matchCatalogFromCatalogName(catalogName)

matchCatalogFromCatalogName(catalogName: string): string | number;

Parse the catalog from Catalog resource.

Parameter
NameDescription
catalogName string

A fully-qualified path representing Catalog resource.

Returns
TypeDescription
string | number

{string} A string representing the catalog.

matchCatalogFromProductName(productName)

matchCatalogFromProductName(productName: string): string | number;

Parse the catalog from Product resource.

Parameter
NameDescription
productName string

A fully-qualified path representing Product resource.

Returns
TypeDescription
string | number

{string} A string representing the catalog.

matchLocationFromCatalogName(catalogName)

matchLocationFromCatalogName(catalogName: string): string | number;

Parse the location from Catalog resource.

Parameter
NameDescription
catalogName string

A fully-qualified path representing Catalog resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchLocationFromProductName(productName)

matchLocationFromProductName(productName: string): string | number;

Parse the location from Product resource.

Parameter
NameDescription
productName string

A fully-qualified path representing Product resource.

Returns
TypeDescription
string | number

{string} A string representing the location.

matchProductFromProductName(productName)

matchProductFromProductName(productName: string): string | number;

Parse the product from Product resource.

Parameter
NameDescription
productName string

A fully-qualified path representing Product resource.

Returns
TypeDescription
string | number

{string} A string representing the product.

matchProjectFromCatalogName(catalogName)

matchProjectFromCatalogName(catalogName: string): string | number;

Parse the project from Catalog resource.

Parameter
NameDescription
catalogName string

A fully-qualified path representing Catalog resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

matchProjectFromProductName(productName)

matchProjectFromProductName(productName: string): string | number;

Parse the project from Product resource.

Parameter
NameDescription
productName string

A fully-qualified path representing Product resource.

Returns
TypeDescription
string | number

{string} A string representing the project.

productPath(project, location, catalog, branch, product)

productPath(project: string, location: string, catalog: string, branch: string, product: string): string;

Return a fully-qualified product resource name string.

Parameters
NameDescription
project string
location string
catalog string
branch string
product string
Returns
TypeDescription
string

{string} Resource name string.

purgeUserEvents(request, options)

purgeUserEvents(request?: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.retail.v2.IPurgeUserEventsResponse, protos.google.cloud.retail.v2.IPurgeMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Deletes permanently all user events specified by the filter provided. Depending on the number of events specified by the filter, this operation could take hours or days to complete. To test a filter, use the list command first.

Parameters
NameDescription
request protos.google.cloud.retail.v2.IPurgeUserEventsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.retail.v2.IPurgeUserEventsResponse, protos.google.cloud.retail.v2.IPurgeMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the catalog under which the events are
   *  created. The format is
   *  `projects/${projectId}/locations/global/catalogs/${catalogId}`
   */
  // const parent = 'abc123'
  /**
   *  Required. The filter string to specify the events to be deleted with a
   *  length limit of 5,000 characters. Empty string filter is not allowed. The
   *  eligible fields for filtering are:
   *  * `eventType`: Double quoted
   *  UserEvent.event_type google.cloud.retail.v2.UserEvent.event_type  string.
   *  * `eventTime`: in ISO 8601 "zulu" format.
   *  * `visitorId`: Double quoted string. Specifying this will delete all
   *    events associated with a visitor.
   *  * `userId`: Double quoted string. Specifying this will delete all events
   *    associated with a user.
   *  Examples:
   *  * Deleting all events in a time range:
   *    `eventTime > "2012-04-23T18:25:43.511Z"
   *    eventTime < "2012-04-23t18:30:43.511z"`="" *="" *="" deleting="" specific="" eventtype="" in="" time="" range:="" *="" `eventtime=""> "2012-04-23T18:25:43.511Z" eventType = "detail-page-view"`
   *  * Deleting all events for a specific visitor:
   *    `visitorId = "visitor1024"`
   *  The filtering fields are assumed to have an implicit AND.
   */
  // const filter = 'abc123'
  /**
   *  Actually perform the purge.
   *  If `force` is set to false, the method will return the expected purge count
   *  without deleting any user events.
   */
  // const force = true

  // Imports the Retail library
  const {UserEventServiceClient} = require('@google-cloud/retail').v2;

  // Instantiates a client
  const retailClient = new UserEventServiceClient();

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

    // Run request
    const [operation] = await retailClient.purgeUserEvents(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callPurgeUserEvents();

purgeUserEvents(request, options, callback)

purgeUserEvents(request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.retail.v2.IPurgeUserEventsResponse, protos.google.cloud.retail.v2.IPurgeMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.retail.v2.IPurgeUserEventsRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.retail.v2.IPurgeUserEventsResponse, protos.google.cloud.retail.v2.IPurgeMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

purgeUserEvents(request, callback)

purgeUserEvents(request: protos.google.cloud.retail.v2.IPurgeUserEventsRequest, callback: Callback<LROperation<protos.google.cloud.retail.v2.IPurgeUserEventsResponse, protos.google.cloud.retail.v2.IPurgeMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.retail.v2.IPurgeUserEventsRequest
callback Callback<LROperation<protos.google.cloud.retail.v2.IPurgeUserEventsResponse, protos.google.cloud.retail.v2.IPurgeMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

rejoinUserEvents(request, options)

rejoinUserEvents(request?: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, options?: CallOptions): Promise<[
        LROperation<protos.google.cloud.retail.v2.IRejoinUserEventsResponse, protos.google.cloud.retail.v2.IRejoinUserEventsMetadata>,
        protos.google.longrunning.IOperation | undefined,
        {} | undefined
    ]>;

Triggers a user event rejoin operation with latest product catalog. Events will not be annotated with detailed product information if product is missing from the catalog at the time the user event is ingested, and these events are stored as unjoined events with a limited usage on training and serving. This API can be used to trigger a 'join' operation on specified events with latest version of product catalog. It can also be used to correct events joined with wrong product catalog.

Parameters
NameDescription
request protos.google.cloud.retail.v2.IRejoinUserEventsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ LROperation<protos.google.cloud.retail.v2.IRejoinUserEventsResponse, protos.google.cloud.retail.v2.IRejoinUserEventsMetadata>, protos.google.longrunning.IOperation | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing a long running operation. Its promise() method returns a promise you can await for. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent catalog resource name, such as
   *  `projects/1234/locations/global/catalogs/default_catalog`.
   */
  // const parent = 'abc123'
  /**
   *  The type of the user event rejoin to define the scope and range of the user
   *  events to be rejoined with the latest product catalog. Defaults to
   *  USER_EVENT_REJOIN_SCOPE_UNSPECIFIED if this field is not set, or set to an
   *  invalid integer value.
   */
  // const userEventRejoinScope = {}

  // Imports the Retail library
  const {UserEventServiceClient} = require('@google-cloud/retail').v2;

  // Instantiates a client
  const retailClient = new UserEventServiceClient();

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

    // Run request
    const [operation] = await retailClient.rejoinUserEvents(request);
    const [response] = await operation.promise();
    console.log(response);
  }

  callRejoinUserEvents();

rejoinUserEvents(request, options, callback)

rejoinUserEvents(request: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, options: CallOptions, callback: Callback<LROperation<protos.google.cloud.retail.v2.IRejoinUserEventsResponse, protos.google.cloud.retail.v2.IRejoinUserEventsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.retail.v2.IRejoinUserEventsRequest
options CallOptions
callback Callback<LROperation<protos.google.cloud.retail.v2.IRejoinUserEventsResponse, protos.google.cloud.retail.v2.IRejoinUserEventsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

rejoinUserEvents(request, callback)

rejoinUserEvents(request: protos.google.cloud.retail.v2.IRejoinUserEventsRequest, callback: Callback<LROperation<protos.google.cloud.retail.v2.IRejoinUserEventsResponse, protos.google.cloud.retail.v2.IRejoinUserEventsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.retail.v2.IRejoinUserEventsRequest
callback Callback<LROperation<protos.google.cloud.retail.v2.IRejoinUserEventsResponse, protos.google.cloud.retail.v2.IRejoinUserEventsMetadata>, protos.google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

writeUserEvent(request, options)

writeUserEvent(request?: protos.google.cloud.retail.v2.IWriteUserEventRequest, options?: CallOptions): Promise<[
        protos.google.cloud.retail.v2.IUserEvent,
        protos.google.cloud.retail.v2.IWriteUserEventRequest | undefined,
        {} | undefined
    ]>;

Writes a single user event.

Parameters
NameDescription
request protos.google.cloud.retail.v2.IWriteUserEventRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.cloud.retail.v2.IUserEvent, protos.google.cloud.retail.v2.IWriteUserEventRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing [UserEvent]. Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) for more details and examples.

Example

  /**
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The parent catalog resource name, such as
   *  `projects/1234/locations/global/catalogs/default_catalog`.
   */
  // const parent = 'abc123'
  /**
   *  Required. User event to write.
   */
  // const userEvent = {}

  // Imports the Retail library
  const {UserEventServiceClient} = require('@google-cloud/retail').v2;

  // Instantiates a client
  const retailClient = new UserEventServiceClient();

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

    // Run request
    const response = await retailClient.writeUserEvent(request);
    console.log(response);
  }

  callWriteUserEvent();

writeUserEvent(request, options, callback)

writeUserEvent(request: protos.google.cloud.retail.v2.IWriteUserEventRequest, options: CallOptions, callback: Callback<protos.google.cloud.retail.v2.IUserEvent, protos.google.cloud.retail.v2.IWriteUserEventRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.retail.v2.IWriteUserEventRequest
options CallOptions
callback Callback<protos.google.cloud.retail.v2.IUserEvent, protos.google.cloud.retail.v2.IWriteUserEventRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void

writeUserEvent(request, callback)

writeUserEvent(request: protos.google.cloud.retail.v2.IWriteUserEventRequest, callback: Callback<protos.google.cloud.retail.v2.IUserEvent, protos.google.cloud.retail.v2.IWriteUserEventRequest | null | undefined, {} | null | undefined>): void;
Parameters
NameDescription
request protos.google.cloud.retail.v2.IWriteUserEventRequest
callback Callback<protos.google.cloud.retail.v2.IUserEvent, protos.google.cloud.retail.v2.IWriteUserEventRequest | null | undefined, {} | null | undefined>
Returns
TypeDescription
void