Skip to content

Commit cb79689

Browse files
authored
fix(samples): removed add time from lro. (#530)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://github.com/googleapis/java-retail/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes #<issue_number_goes_here> ☕️ If you write sample code, please follow the [samples format]( https://github.com/GoogleCloudPlatform/java-docs-samples/blob/main/SAMPLE_FORMAT.md).
1 parent a24d44d commit cb79689

File tree

3 files changed

+5
-28
lines changed

3 files changed

+5
-28
lines changed

retail/interactive-tutorials/src/main/java/product/AddFulfillmentPlaces.java

+2-9
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
import com.google.cloud.ServiceOptions;
2424
import com.google.cloud.retail.v2.AddFulfillmentPlacesRequest;
2525
import com.google.cloud.retail.v2.ProductServiceClient;
26-
import com.google.protobuf.Timestamp;
2726
import java.io.IOException;
28-
import java.time.Instant;
2927
import java.util.UUID;
3028
import java.util.concurrent.TimeUnit;
3129

@@ -47,22 +45,17 @@ public static void main(String[] args) throws IOException, InterruptedException
4745

4846
public static void addFulfillmentPlaces(String productName, String placeId)
4947
throws IOException, InterruptedException {
50-
Timestamp currentDate =
51-
Timestamp.newBuilder()
52-
.setSeconds(Instant.now().getEpochSecond())
53-
.setNanos(Instant.now().getNano())
54-
.build();
5548

56-
System.out.printf("Add fulfilment places with current date: %s", currentDate);
49+
System.out.println("Add fulfilment places");
5750

5851
AddFulfillmentPlacesRequest addFulfillmentPlacesRequest =
5952
AddFulfillmentPlacesRequest.newBuilder()
6053
.setProduct(productName)
6154
.setType("pickup-in-store")
6255
.addPlaceIds(placeId)
63-
.setAddTime(currentDate)
6456
.setAllowMissing(true)
6557
.build();
58+
6659
System.out.println("Add fulfillment request " + addFulfillmentPlacesRequest);
6760

6861
// Initialize client that will be used to send requests. This client only

retail/interactive-tutorials/src/main/java/product/RemoveFulfillmentPlaces.java

+3-9
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@
2323
import com.google.cloud.ServiceOptions;
2424
import com.google.cloud.retail.v2.ProductServiceClient;
2525
import com.google.cloud.retail.v2.RemoveFulfillmentPlacesRequest;
26-
import com.google.protobuf.Timestamp;
2726
import java.io.IOException;
28-
import java.time.Instant;
2927
import java.util.UUID;
3028
import java.util.concurrent.TimeUnit;
3129

@@ -48,21 +46,17 @@ public static void main(String[] args) throws IOException, InterruptedException
4846
// remove fulfillment places to product
4947
public static void removeFulfillmentPlaces(String productName, String storeId)
5048
throws IOException, InterruptedException {
51-
Timestamp currentDate =
52-
Timestamp.newBuilder()
53-
.setSeconds(Instant.now().getEpochSecond())
54-
.setNanos(Instant.now().getNano())
55-
.build();
5649

57-
System.out.printf("Remove fulfilment places with current date: %s", currentDate);
50+
System.out.println("Remove fulfilment places with current date");
51+
5852
RemoveFulfillmentPlacesRequest removeFulfillmentRequest =
5953
RemoveFulfillmentPlacesRequest.newBuilder()
6054
.setProduct(productName)
6155
.setType("pickup-in-store")
6256
.addPlaceIds(storeId)
63-
.setRemoveTime(currentDate)
6457
.setAllowMissing(true)
6558
.build();
59+
6660
System.out.println("Remove fulfillment request " + removeFulfillmentRequest);
6761

6862
// Initialize client that will be used to send requests. This client only

retail/interactive-tutorials/src/main/java/product/SetInventory.java

-10
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
import com.google.cloud.retail.v2.SetInventoryRequest;
3030
import com.google.protobuf.FieldMask;
3131
import com.google.protobuf.Int32Value;
32-
import com.google.protobuf.Timestamp;
3332
import java.io.IOException;
34-
import java.time.Instant;
3533
import java.util.Arrays;
3634
import java.util.UUID;
3735
import java.util.concurrent.TimeUnit;
@@ -57,13 +55,6 @@ public static void setInventory(String productName) throws IOException, Interrup
5755
float originalPrice = 20.0f;
5856
float cost = 8.0f;
5957

60-
// The request timestamp
61-
Timestamp requestTime =
62-
Timestamp.newBuilder()
63-
.setSeconds(Instant.now().getEpochSecond())
64-
.setNanos(Instant.now().getNano())
65-
.build();
66-
6758
FieldMask setMask =
6859
FieldMask.newBuilder()
6960
.addAllPaths(
@@ -97,7 +88,6 @@ public static void setInventory(String productName) throws IOException, Interrup
9788
SetInventoryRequest setInventoryRequest =
9889
SetInventoryRequest.newBuilder()
9990
.setInventory(product)
100-
.setSetTime(requestTime)
10191
.setAllowMissing(true)
10292
.setSetMask(setMask)
10393
.build();

0 commit comments

Comments
 (0)