Skip to content

Commit

Permalink
chore(samples): refactoring comments. (#528)
Browse files Browse the repository at this point in the history
* chore (samples) Refactoring comments.

* pr fix: refactored comments.

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
dfirova and gcf-owl-bot[bot] authored Sep 29, 2022
1 parent 76ed2d0 commit 31b46eb
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,19 @@
public class ImportUserEventsBigQuery {

public static void main(String[] args) throws IOException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
// TODO(developer): Set projectId to your Google Cloud Platform project ID.
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalog =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
// TO CHECK ERROR HANDLING PASTE THE INVALID CATALOG NAME HERE:
// To check error handling use invalid catalog name here:
// defaultCatalog = "invalid_catalog_name";

// TODO(developer): Set datasetId to your datasetId
String datasetId = "user_events";
// TODO(developer): Set tableId to your tableId
String tableId = "events";
// TO CHECK ERROR HANDLING USE THE TABLE OF INVALID USER EVENTS:
// tableId = "events_some_invalid";
// To check error handling use table of invalid user events here:
// tableId = "events_some_invalid"

importUserEventsFromBigQuery(projectId, defaultCatalog, datasetId, tableId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/*
* Purge user events into a catalog from inline source using Retail API
* Deleting user event using Retail API.
*/

package events;
Expand All @@ -36,11 +36,11 @@ public class PurgeUserEvent {

public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
// TODO(developer): Set projectId to your Google Cloud Platform project ID.
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalog =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
// visitorId generated randomly.
// visitorId is generated randomly
String visitorId = UUID.randomUUID().toString();

callPurgeUserEvents(defaultCatalog, visitorId);
Expand All @@ -57,9 +57,11 @@ public static void callPurgeUserEvents(String defaultCatalog, String visitorId)
try (UserEventServiceClient userEventServiceClient = UserEventServiceClient.create()) {
PurgeUserEventsRequest purgeUserEventsRequest =
PurgeUserEventsRequest.newBuilder()
// TO CHECK ERROR HANDLING SET INVALID FILTER HERE:
// To check error handling set invalid filter here:
.setFilter(String.format("visitorId=\"%s\"", visitorId))
.setParent(defaultCatalog)
// Setting the force field to true deletes user events. If set to false will return
// number of events to be deleted without actually deleting them
.setForce(true)
.build();
System.out.printf("Purge user events request: %s%n", purgeUserEventsRequest);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/*
* Rejoin user events into a catalog from inline source using Retail API
* Starts a user event rejoin operation using Retail API.
*/

package events;
Expand All @@ -38,11 +38,11 @@ public class RejoinUserEvent {

public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
// TODO(developer): Set projectId to your Google Cloud Platform project ID.
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalog =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
// visitorId generated randomly.
// visitorId is generated randomly
String visitorId = UUID.randomUUID().toString();

callRejoinUserEvents(defaultCatalog, visitorId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

/*
* Write user events into a catalog from inline source using Retail API
* Write user event using Retail API.
*/

package events;
Expand All @@ -36,11 +36,11 @@ public class WriteUserEvent {

public static void main(String[] args)
throws IOException, ExecutionException, InterruptedException {
// TODO(developer): Replace these variables before running the sample.
// TODO(developer): Set projectId to your Google Cloud Platform project ID.
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalog =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
// visitorId generated randomly.
// visitorId is generated randomly
String visitorId = UUID.randomUUID().toString();

writeUserEvent(defaultCatalog, visitorId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@
*/

/*
* Create product in a catalog using Retail API
* Create, update, get and delete product in a catalog using Retail API.
*/

package product;

import com.google.api.gax.rpc.NotFoundException;
import com.google.cloud.ServiceOptions;
import com.google.cloud.retail.v2.CreateProductRequest;
import com.google.cloud.retail.v2.DeleteProductRequest;
import com.google.cloud.retail.v2.GetProductRequest;
Expand All @@ -37,7 +36,8 @@
public class CrudProduct {

public static void main(String[] args) throws IOException {
String projectId = ServiceOptions.getDefaultProjectId();
// TODO(developer): Set projectId to your Google Cloud Platform project ID.
String projectId = "my-project";
String generatedProductId = UUID.randomUUID().toString();
String branchName =
String.format(
Expand Down

0 comments on commit 31b46eb

Please sign in to comment.