Class v2beta.UserEventServiceClient (2.4.1)

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

Package

@google-cloud/retail

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of UserEventServiceClient.

Parameters
Name
Description
opts
ClientOptions
gaxInstance
typeof gax | typeof gax.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 UserEventServiceClient({fallback: 'rest'}, gax); ```

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

locationsClient

  locationsClient 
 : 
  
 LocationsClient 
 ; 
 

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

attributesConfigPath(project, location, catalog)

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

Return a fully-qualified attributesConfig resource name string.

Parameters
Name
Description
project
string
location
string
catalog
string
Returns
Type
Description
string

{string} Resource name string.

cancelOperation(request, options, callback)

  cancelOperation 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 CancelOperationRequest 
 , 
  
 options 
 ?: 
  
 gax 
 . 
 CallOptions 
  
 | 
  
 Callback<protos 
 . 
 google 
 . 
 protobuf 
 . 
 Empty 
 , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 CancelOperationRequest 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 | 
  
 null 
> , 
  
 callback 
 ?: 
  
 Callback<protos 
 . 
 google 
 . 
 longrunning 
 . 
 CancelOperationRequest 
 , 
  
 protos 
 . 
 google 
 . 
 protobuf 
 . 
 Empty 
 , 
  
 {} 
  
 | 
  
 undefined 
  
 | 
  
 null 
> ) 
 : 
  
 Promise<protos 
 . 
 google 
 . 
 protobuf 
 . 
 Empty 
> ; 
 

Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED . Clients can use or other methods to check whether the cancellation succeeded or whether the operation completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an value with a of 1, corresponding to Code.CANCELLED .

Parameters
Name
Description
request
protos. google.longrunning.CancelOperationRequest

The request object that will be sent.

options
gax. CallOptions | Callback <protos. google.protobuf.Empty , protos. google.longrunning.CancelOperationRequest , {} | undefined | null>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback
Callback <protos. google.longrunning.CancelOperationRequest , protos. google.protobuf.Empty , {} | undefined | null>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type
Description
Promise <protos. google.protobuf.Empty >
Example
  const 
  
 client 
  
 = 
  
 longrunning 
 . 
 operationsClient 
 (); 
 await 
  
 client 
 . 
 cancelOperation 
 ({ 
 name 
 : 
  
 '' 
 }); 
 

catalogPath(project, location, catalog)

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

Return a fully-qualified catalog resource name string.

Parameters
Name
Description
project
string
location
string
catalog
string
Returns
Type
Description
string

{string} Resource name string.

checkImportUserEventsProgress(name)

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

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

Parameter
Name
Description
name
string

The operation name that will be passed.

Returns
Type
Description
Promise < LROperation <protos. google.cloud.retail.v2beta.ImportUserEventsResponse , protos. google.cloud.retail.v2beta.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
   
 /** 
 * 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. `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 
' 
 ). 
 v2beta 
 ; 
  
 // 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 
 . 
 v2beta 
 . 
 PurgeUserEventsResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 PurgeMetadata 
>> ; 
 

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

Parameter
Name
Description
name
string

The operation name that will be passed.

Returns
Type
Description
Promise < LROperation <protos. google.cloud.retail.v2beta.PurgeUserEventsResponse , protos. google.cloud.retail.v2beta.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
   
 /** 
 * 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 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.v2beta.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 
' 
 ). 
 v2beta 
 ; 
  
 // 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 
 . 
 v2beta 
 . 
 RejoinUserEventsResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 RejoinUserEventsMetadata 
>> ; 
 

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

Parameter
Name
Description
name
string

The operation name that will be passed.

Returns
Type
Description
Promise < LROperation <protos. google.cloud.retail.v2beta.RejoinUserEventsResponse , protos. google.cloud.retail.v2beta.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
   
 /** 
 * 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 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 
' 
 ). 
 v2beta 
 ; 
  
 // 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
Type
Description
Promise <void>

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

collectUserEvent(request, options)

  collectUserEvent 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 ICollectUserEventRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 protos 
 . 
 google 
 . 
 api 
 . 
 IHttpBody 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 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
Name
Description
request
protos. google.cloud.retail.v2beta.ICollectUserEventRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description
Promise <[ protos. google.api.IHttpBody , protos. google.cloud.retail.v2beta.ICollectUserEventRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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. 
 */ 
  
 /** 
 *  The prebuilt rule name that can convert a specific type of raw_json. 
 *  For example: "ga4_bq" rule for the GA4 user event schema. 
 */ 
  
 // const prebuiltRule = 'abc123' 
  
 /** 
 *  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 
  
 /** 
 *  An arbitrary serialized JSON string that contains necessary information 
 *  that can comprise a user event. When this field is specified, the 
 *  user_event field will be ignored. Note: line-delimited JSON is not 
 *  supported, a single JSON only. 
 */ 
  
 // const rawJson = 'abc123' 
  
 // Imports the Retail library 
  
 const 
  
 { 
 UserEventServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/retail 
' 
 ). 
 v2beta 
 ; 
  
 // 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 
 . 
 v2beta 
 . 
 ICollectUserEventRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 api 
 . 
 IHttpBody 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 ICollectUserEventRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
request
protos. google.cloud.retail.v2beta.ICollectUserEventRequest
options
CallOptions
callback
Callback <protos. google.api.IHttpBody , protos. google.cloud.retail.v2beta.ICollectUserEventRequest | null | undefined, {} | null | undefined>
Returns
Type
Description
void

collectUserEvent(request, callback)

  collectUserEvent 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 ICollectUserEventRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 api 
 . 
 IHttpBody 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 ICollectUserEventRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
request
protos. google.cloud.retail.v2beta.ICollectUserEventRequest
callback
Callback <protos. google.api.IHttpBody , protos. google.cloud.retail.v2beta.ICollectUserEventRequest | null | undefined, {} | null | undefined>
Returns
Type
Description
void

completionConfigPath(project, location, catalog)

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

Return a fully-qualified completionConfig resource name string.

Parameters
Name
Description
project
string
location
string
catalog
string
Returns
Type
Description
string

{string} Resource name string.

controlPath(project, location, catalog, control)

  controlPath 
 ( 
 project 
 : 
  
 string 
 , 
  
 location 
 : 
  
 string 
 , 
  
 catalog 
 : 
  
 string 
 , 
  
 control 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Return a fully-qualified control resource name string.

Parameters
Name
Description
project
string
location
string
catalog
string
control
string
Returns
Type
Description
string

{string} Resource name string.

deleteOperation(request, options, callback)

  deleteOperation 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 DeleteOperationRequest 
 , 
  
 options 
 ?: 
  
 gax 
 . 
 CallOptions 
  
 | 
  
 Callback<protos 
 . 
 google 
 . 
 protobuf 
 . 
 Empty 
 , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 DeleteOperationRequest 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> , 
  
 callback 
 ?: 
  
 Callback<protos 
 . 
 google 
 . 
 protobuf 
 . 
 Empty 
 , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 DeleteOperationRequest 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 Promise<protos 
 . 
 google 
 . 
 protobuf 
 . 
 Empty 
> ; 
 

Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support this method, it returns google.rpc.Code.UNIMPLEMENTED .

Parameters
Name
Description
request
protos. google.longrunning.DeleteOperationRequest

The request object that will be sent.

options
gax. CallOptions | Callback <protos. google.protobuf.Empty , protos. google.longrunning.DeleteOperationRequest , {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback
Callback <protos. google.protobuf.Empty , protos. google.longrunning.DeleteOperationRequest , {} | null | undefined>

The function which will be called with the result of the API call. {Promise} - The promise which resolves when API call finishes. The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type
Description
Promise <protos. google.protobuf.Empty >
Example
  const 
  
 client 
  
 = 
  
 longrunning 
 . 
 operationsClient 
 (); 
 await 
  
 client 
 . 
 deleteOperation 
 ({ 
 name 
 : 
  
 '' 
 }); 
 

getLocation(request, options, callback)

  getLocation 
 ( 
 request 
 : 
  
 LocationProtos 
 . 
 google 
 . 
 cloud 
 . 
 location 
 . 
 IGetLocationRequest 
 , 
  
 options 
 ?: 
  
 gax 
 . 
 CallOptions 
  
 | 
  
 Callback<LocationProtos 
 . 
 google 
 . 
 cloud 
 . 
 location 
 . 
 ILocation 
 , 
  
 LocationProtos 
 . 
 google 
 . 
 cloud 
 . 
 location 
 . 
 IGetLocationRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> , 
  
 callback 
 ?: 
  
 Callback<LocationProtos 
 . 
 google 
 . 
 cloud 
 . 
 location 
 . 
 ILocation 
 , 
  
 LocationProtos 
 . 
 google 
 . 
 cloud 
 . 
 location 
 . 
 IGetLocationRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 Promise<LocationProtos 
 . 
 google 
 . 
 cloud 
 . 
 location 
 . 
 ILocation 
> ; 
 

Gets information about a location.

Parameters
Name
Description
request
LocationProtos. google.cloud.location.IGetLocationRequest

The request object that will be sent.

options
gax. CallOptions | Callback <LocationProtos. google.cloud.location.ILocation , LocationProtos. google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>

Call options. See CallOptions for more details.

callback
Callback <LocationProtos. google.cloud.location.ILocation , LocationProtos. google.cloud.location.IGetLocationRequest | null | undefined, {} | null | undefined>
Returns
Type
Description
Promise <LocationProtos. google.cloud.location.ILocation >

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

Example
  const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 client 
 . 
 getLocation 
 ( 
 request 
 ); 
 

getOperation(request, options, callback)

  getOperation 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 GetOperationRequest 
 , 
  
 options 
 ?: 
  
 gax 
 . 
 CallOptions 
  
 | 
  
 Callback<protos 
 . 
 google 
 . 
 longrunning 
 . 
 Operation 
 , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 GetOperationRequest 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> , 
  
 callback 
 ?: 
  
 Callback<protos 
 . 
 google 
 . 
 longrunning 
 . 
 Operation 
 , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 GetOperationRequest 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 Promise 
< [ 
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 Operation 
 ]>; 
 

Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.

Parameters
Name
Description
request
protos. google.longrunning.GetOperationRequest

The request object that will be sent.

options
gax. CallOptions | Callback <protos. google.longrunning.Operation , protos. google.longrunning.GetOperationRequest , {} | null | undefined>

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

callback
Callback <protos. google.longrunning.Operation , protos. google.longrunning.GetOperationRequest , {} | null | undefined>

The function which will be called with the result of the API call.

The second parameter to the callback is an object representing . {Promise} - The promise which resolves to an array. The first element of the array is an object representing . The promise has a method named "cancel" which cancels the ongoing API call.

Returns
Type
Description
Promise <[protos. google.longrunning.Operation ]>
Example
  const 
  
 client 
  
 = 
  
 longrunning 
 . 
 operationsClient 
 (); 
 const 
  
 name 
  
 = 
  
 '' 
 ; 
 const 
  
 [ 
 response 
 ] 
  
 = 
  
 await 
  
 client 
 . 
 getOperation 
 ({ 
 name 
 }); 
 // doThingsWith(response) 
 

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

importUserEvents(request, options)

  importUserEvents 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IImportUserEventsRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IImportUserEventsResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 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
Name
Description
request
protos. google.cloud.retail.v2beta.IImportUserEventsRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description
Promise <[ LROperation <protos. google.cloud.retail.v2beta.IImportUserEventsResponse , protos. google.cloud.retail.v2beta.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
   
 /** 
 * 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. `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 
' 
 ). 
 v2beta 
 ; 
  
 // 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 
 . 
 v2beta 
 . 
 IImportUserEventsRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IImportUserEventsResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IImportMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
request
protos. google.cloud.retail.v2beta.IImportUserEventsRequest
options
CallOptions
callback
Callback < LROperation <protos. google.cloud.retail.v2beta.IImportUserEventsResponse , protos. google.cloud.retail.v2beta.IImportMetadata >, protos. google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type
Description
void

importUserEvents(request, callback)

  importUserEvents 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IImportUserEventsRequest 
 , 
  
 callback 
 : 
  
 Callback<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IImportUserEventsResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IImportMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
request
protos. google.cloud.retail.v2beta.IImportUserEventsRequest
callback
Callback < LROperation <protos. google.cloud.retail.v2beta.IImportUserEventsResponse , protos. google.cloud.retail.v2beta.IImportMetadata >, protos. google.longrunning.IOperation | null | undefined, {} | null | 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.

listLocationsAsync(request, options)

  listLocationsAsync 
 ( 
 request 
 : 
  
 LocationProtos 
 . 
 google 
 . 
 cloud 
 . 
 location 
 . 
 IListLocationsRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 AsyncIterable<LocationProtos 
 . 
 google 
 . 
 cloud 
 . 
 location 
 . 
 ILocation 
> ; 
 

Lists information about the supported locations for this service. Returns an iterable object.

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

Parameters
Name
Description
request
LocationProtos. google.cloud.location.IListLocationsRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description
AsyncIterable <LocationProtos. google.cloud.location.ILocation >

{Object} An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). When you iterate the returned iterable, each element will be an object representing . 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](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) for more details and examples.

Example
  const 
  
 iterable 
  
 = 
  
 client 
 . 
 listLocationsAsync 
 ( 
 request 
 ); 
 for 
  
 await 
  
 ( 
 const 
  
 response 
  
 of 
  
 iterable 
 ) 
  
 { 
  
 // process response 
 } 
 

listOperationsAsync(request, options)

  listOperationsAsync 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 ListOperationsRequest 
 , 
  
 options 
 ?: 
  
 gax 
 . 
 CallOptions 
 ) 
 : 
  
 AsyncIterable<protos 
 . 
 google 
 . 
 longrunning 
 . 
 ListOperationsResponse 
> ; 
 

Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns UNIMPLEMENTED . Returns an iterable object.

For-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters
Name
Description
request
protos. google.longrunning.ListOperationsRequest

The request object that will be sent.

options
gax. CallOptions

Optional parameters. You can override the default settings for this call, e.g, timeout, retries, paginations, etc. See gax.CallOptions for the details.

Returns
Type
Description
AsyncIterable <protos. google.longrunning.ListOperationsResponse >

{Object} An iterable Object that conforms to iteration protocols .

Example
  const 
  
 client 
  
 = 
  
 longrunning 
 . 
 operationsClient 
 (); 
 for 
  
 await 
  
 ( 
 const 
  
 response 
  
 of 
  
 client 
 . 
 listOperationsAsync 
 ( 
 request 
 )); 
 // doThingsWith(response) 
 

matchBranchFromProductName(productName)

  matchBranchFromProductName 
 ( 
 productName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the branch from Product resource.

Parameter
Name
Description
productName
string

A fully-qualified path representing Product resource.

Returns
Type
Description
string | number

{string} A string representing the branch.

matchCatalogFromAttributesConfigName(attributesConfigName)

  matchCatalogFromAttributesConfigName 
 ( 
 attributesConfigName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the catalog from AttributesConfig resource.

Parameter
Name
Description
attributesConfigName
string

A fully-qualified path representing AttributesConfig resource.

Returns
Type
Description
string | number

{string} A string representing the catalog.

matchCatalogFromCatalogName(catalogName)

  matchCatalogFromCatalogName 
 ( 
 catalogName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the catalog from Catalog resource.

Parameter
Name
Description
catalogName
string

A fully-qualified path representing Catalog resource.

Returns
Type
Description
string | number

{string} A string representing the catalog.

matchCatalogFromCompletionConfigName(completionConfigName)

  matchCatalogFromCompletionConfigName 
 ( 
 completionConfigName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the catalog from CompletionConfig resource.

Parameter
Name
Description
completionConfigName
string

A fully-qualified path representing CompletionConfig resource.

Returns
Type
Description
string | number

{string} A string representing the catalog.

matchCatalogFromControlName(controlName)

  matchCatalogFromControlName 
 ( 
 controlName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the catalog from Control resource.

Parameter
Name
Description
controlName
string

A fully-qualified path representing Control resource.

Returns
Type
Description
string | number

{string} A string representing the catalog.

matchCatalogFromModelName(modelName)

  matchCatalogFromModelName 
 ( 
 modelName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the catalog from Model resource.

Parameter
Name
Description
modelName
string

A fully-qualified path representing Model resource.

Returns
Type
Description
string | number

{string} A string representing the catalog.

matchCatalogFromProductName(productName)

  matchCatalogFromProductName 
 ( 
 productName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the catalog from Product resource.

Parameter
Name
Description
productName
string

A fully-qualified path representing Product resource.

Returns
Type
Description
string | number

{string} A string representing the catalog.

matchCatalogFromServingConfigName(servingConfigName)

  matchCatalogFromServingConfigName 
 ( 
 servingConfigName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the catalog from ServingConfig resource.

Parameter
Name
Description
servingConfigName
string

A fully-qualified path representing ServingConfig resource.

Returns
Type
Description
string | number

{string} A string representing the catalog.

matchControlFromControlName(controlName)

  matchControlFromControlName 
 ( 
 controlName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the control from Control resource.

Parameter
Name
Description
controlName
string

A fully-qualified path representing Control resource.

Returns
Type
Description
string | number

{string} A string representing the control.

matchLocationFromAttributesConfigName(attributesConfigName)

  matchLocationFromAttributesConfigName 
 ( 
 attributesConfigName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from AttributesConfig resource.

Parameter
Name
Description
attributesConfigName
string

A fully-qualified path representing AttributesConfig resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchLocationFromCatalogName(catalogName)

  matchLocationFromCatalogName 
 ( 
 catalogName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from Catalog resource.

Parameter
Name
Description
catalogName
string

A fully-qualified path representing Catalog resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchLocationFromCompletionConfigName(completionConfigName)

  matchLocationFromCompletionConfigName 
 ( 
 completionConfigName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from CompletionConfig resource.

Parameter
Name
Description
completionConfigName
string

A fully-qualified path representing CompletionConfig resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchLocationFromControlName(controlName)

  matchLocationFromControlName 
 ( 
 controlName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from Control resource.

Parameter
Name
Description
controlName
string

A fully-qualified path representing Control resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchLocationFromModelName(modelName)

  matchLocationFromModelName 
 ( 
 modelName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from Model resource.

Parameter
Name
Description
modelName
string

A fully-qualified path representing Model resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchLocationFromProductName(productName)

  matchLocationFromProductName 
 ( 
 productName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from Product resource.

Parameter
Name
Description
productName
string

A fully-qualified path representing Product resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchLocationFromServingConfigName(servingConfigName)

  matchLocationFromServingConfigName 
 ( 
 servingConfigName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the location from ServingConfig resource.

Parameter
Name
Description
servingConfigName
string

A fully-qualified path representing ServingConfig resource.

Returns
Type
Description
string | number

{string} A string representing the location.

matchModelFromModelName(modelName)

  matchModelFromModelName 
 ( 
 modelName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the model from Model resource.

Parameter
Name
Description
modelName
string

A fully-qualified path representing Model resource.

Returns
Type
Description
string | number

{string} A string representing the model.

matchProductFromProductName(productName)

  matchProductFromProductName 
 ( 
 productName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the product from Product resource.

Parameter
Name
Description
productName
string

A fully-qualified path representing Product resource.

Returns
Type
Description
string | number

{string} A string representing the product.

matchProjectFromAttributesConfigName(attributesConfigName)

  matchProjectFromAttributesConfigName 
 ( 
 attributesConfigName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from AttributesConfig resource.

Parameter
Name
Description
attributesConfigName
string

A fully-qualified path representing AttributesConfig resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchProjectFromCatalogName(catalogName)

  matchProjectFromCatalogName 
 ( 
 catalogName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from Catalog resource.

Parameter
Name
Description
catalogName
string

A fully-qualified path representing Catalog resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchProjectFromCompletionConfigName(completionConfigName)

  matchProjectFromCompletionConfigName 
 ( 
 completionConfigName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from CompletionConfig resource.

Parameter
Name
Description
completionConfigName
string

A fully-qualified path representing CompletionConfig resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchProjectFromControlName(controlName)

  matchProjectFromControlName 
 ( 
 controlName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from Control resource.

Parameter
Name
Description
controlName
string

A fully-qualified path representing Control resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchProjectFromModelName(modelName)

  matchProjectFromModelName 
 ( 
 modelName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from Model resource.

Parameter
Name
Description
modelName
string

A fully-qualified path representing Model resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchProjectFromProductName(productName)

  matchProjectFromProductName 
 ( 
 productName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from Product resource.

Parameter
Name
Description
productName
string

A fully-qualified path representing Product resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchProjectFromServingConfigName(servingConfigName)

  matchProjectFromServingConfigName 
 ( 
 servingConfigName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the project from ServingConfig resource.

Parameter
Name
Description
servingConfigName
string

A fully-qualified path representing ServingConfig resource.

Returns
Type
Description
string | number

{string} A string representing the project.

matchServingConfigFromServingConfigName(servingConfigName)

  matchServingConfigFromServingConfigName 
 ( 
 servingConfigName 
 : 
  
 string 
 ) 
 : 
  
 string 
  
 | 
  
 number 
 ; 
 

Parse the serving_config from ServingConfig resource.

Parameter
Name
Description
servingConfigName
string

A fully-qualified path representing ServingConfig resource.

Returns
Type
Description
string | number

{string} A string representing the serving_config.

modelPath(project, location, catalog, model)

  modelPath 
 ( 
 project 
 : 
  
 string 
 , 
  
 location 
 : 
  
 string 
 , 
  
 catalog 
 : 
  
 string 
 , 
  
 model 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Return a fully-qualified model resource name string.

Parameters
Name
Description
project
string
location
string
catalog
string
model
string
Returns
Type
Description
string

{string} Resource name string.

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
Name
Description
project
string
location
string
catalog
string
branch
string
product
string
Returns
Type
Description
string

{string} Resource name string.

purgeUserEvents(request, options)

  purgeUserEvents 
 ( 
 request 
 ?: 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IPurgeUserEventsRequest 
 , 
  
 options 
 ?: 
  
 CallOptions 
 ) 
 : 
  
 Promise 
< [ 
  
 LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IPurgeUserEventsResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 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
Name
Description
request
protos. google.cloud.retail.v2beta.IPurgeUserEventsRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description
Promise <[ LROperation <protos. google.cloud.retail.v2beta.IPurgeUserEventsResponse , protos. google.cloud.retail.v2beta.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
   
 /** 
 * 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 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.v2beta.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 
' 
 ). 
 v2beta 
 ; 
  
 // 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 
 . 
 v2beta 
 . 
 IPurgeUserEventsRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IPurgeUserEventsResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IPurgeMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
request
protos. google.cloud.retail.v2beta.IPurgeUserEventsRequest
options
CallOptions
callback
Callback < LROperation <protos. google.cloud.retail.v2beta.IPurgeUserEventsResponse , protos. google.cloud.retail.v2beta.IPurgeMetadata >, protos. google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type
Description
void

purgeUserEvents(request, callback)

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

rejoinUserEvents(request, options)

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

Starts a user-event rejoin operation with latest product catalog. Events are not annotated with detailed product information for products that are missing from the catalog when the user event is ingested. These events are stored as unjoined events with limited usage on training and serving. You can use this method to start a join operation on specified events with the latest version of product catalog. You can also use this method to correct events joined with the wrong product catalog. A rejoin operation can take hours or days to complete.

Parameters
Name
Description
request
protos. google.cloud.retail.v2beta.IRejoinUserEventsRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description
Promise <[ LROperation <protos. google.cloud.retail.v2beta.IRejoinUserEventsResponse , protos. google.cloud.retail.v2beta.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
   
 /** 
 * 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 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 
' 
 ). 
 v2beta 
 ; 
  
 // 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 
 . 
 v2beta 
 . 
 IRejoinUserEventsRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<LROperation<protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IRejoinUserEventsResponse 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IRejoinUserEventsMetadata 
> , 
  
 protos 
 . 
 google 
 . 
 longrunning 
 . 
 IOperation 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
request
protos. google.cloud.retail.v2beta.IRejoinUserEventsRequest
options
CallOptions
callback
Callback < LROperation <protos. google.cloud.retail.v2beta.IRejoinUserEventsResponse , protos. google.cloud.retail.v2beta.IRejoinUserEventsMetadata >, protos. google.longrunning.IOperation | null | undefined, {} | null | undefined>
Returns
Type
Description
void

rejoinUserEvents(request, callback)

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

servingConfigPath(project, location, catalog, servingConfig)

  servingConfigPath 
 ( 
 project 
 : 
  
 string 
 , 
  
 location 
 : 
  
 string 
 , 
  
 catalog 
 : 
  
 string 
 , 
  
 servingConfig 
 : 
  
 string 
 ) 
 : 
  
 string 
 ; 
 

Return a fully-qualified servingConfig resource name string.

Parameters
Name
Description
project
string
location
string
catalog
string
servingConfig
string
Returns
Type
Description
string

{string} Resource name string.

writeUserEvent(request, options)

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

Writes a single user event.

Parameters
Name
Description
request
protos. google.cloud.retail.v2beta.IWriteUserEventRequest

The request object that will be sent.

options
CallOptions

Call options. See CallOptions for more details.

Returns
Type
Description
Promise <[ protos. google.cloud.retail.v2beta.IUserEvent , protos. google.cloud.retail.v2beta.IWriteUserEventRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing . Please see the [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) 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 parent catalog resource name, such as 
 *  `projects/1234/locations/global/catalogs/default_catalog`. 
 */ 
  
 // const parent = 'abc123' 
  
 /** 
 *  Required. User event to write. 
 */ 
  
 // const userEvent = {} 
  
 /** 
 *  If set to true, the user event will be written asynchronously after 
 *  validation, and the API will respond without waiting for the write. 
 *  Therefore, silent failures can occur even if the API returns success. In 
 *  case of silent failures, error messages can be found in Stackdriver logs. 
 */ 
  
 // const writeAsync = true 
  
 // Imports the Retail library 
  
 const 
  
 { 
 UserEventServiceClient 
 } 
  
 = 
  
 require 
 ( 
 ' @google-cloud/retail 
' 
 ). 
 v2beta 
 ; 
  
 // 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 
 . 
 v2beta 
 . 
 IWriteUserEventRequest 
 , 
  
 options 
 : 
  
 CallOptions 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IUserEvent 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IWriteUserEventRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
request
protos. google.cloud.retail.v2beta.IWriteUserEventRequest
options
CallOptions
callback
Callback <protos. google.cloud.retail.v2beta.IUserEvent , protos. google.cloud.retail.v2beta.IWriteUserEventRequest | null | undefined, {} | null | undefined>
Returns
Type
Description
void

writeUserEvent(request, callback)

  writeUserEvent 
 ( 
 request 
 : 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IWriteUserEventRequest 
 , 
  
 callback 
 : 
  
 Callback<protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IUserEvent 
 , 
  
 protos 
 . 
 google 
 . 
 cloud 
 . 
 retail 
 . 
 v2beta 
 . 
 IWriteUserEventRequest 
  
 | 
  
 null 
  
 | 
  
 undefined 
 , 
  
 {} 
  
 | 
  
 null 
  
 | 
  
 undefined 
> ) 
 : 
  
 void 
 ; 
 
Parameters
Name
Description
request
protos. google.cloud.retail.v2beta.IWriteUserEventRequest
callback
Callback <protos. google.cloud.retail.v2beta.IUserEvent , protos. google.cloud.retail.v2beta.IWriteUserEventRequest | null | undefined, {} | null | undefined>
Returns
Type
Description
void
Create a Mobile Website
View Site in Mobile | Classic
Share by: