1 /* 2 * Copyright 2020 Google LLC 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * https://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 // Generated by the protocol buffer compiler. DO NOT EDIT! 17 // source: google/cloud/retail/v2/prediction_service.proto 18 19 package com.google.cloud.retail.v2; 20 21 /** 22 * 23 * 24 * <pre> 25 * Request message for Predict method. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.retail.v2.PredictRequest} 29 */ 30 public final class PredictRequest extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.PredictRequest) 33 PredictRequestOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use PredictRequest.newBuilder() to construct. PredictRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private PredictRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 PredictRequest()40 private PredictRequest() { 41 placement_ = ""; 42 pageToken_ = ""; 43 filter_ = ""; 44 } 45 46 @java.lang.Override 47 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)48 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 49 return new PredictRequest(); 50 } 51 52 @java.lang.Override getUnknownFields()53 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 54 return this.unknownFields; 55 } 56 getDescriptor()57 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 58 return com.google.cloud.retail.v2.PredictionServiceProto 59 .internal_static_google_cloud_retail_v2_PredictRequest_descriptor; 60 } 61 62 @SuppressWarnings({"rawtypes"}) 63 @java.lang.Override internalGetMapField(int number)64 protected com.google.protobuf.MapField internalGetMapField(int number) { 65 switch (number) { 66 case 7: 67 return internalGetParams(); 68 case 8: 69 return internalGetLabels(); 70 default: 71 throw new RuntimeException("Invalid map field number: " + number); 72 } 73 } 74 75 @java.lang.Override 76 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()77 internalGetFieldAccessorTable() { 78 return com.google.cloud.retail.v2.PredictionServiceProto 79 .internal_static_google_cloud_retail_v2_PredictRequest_fieldAccessorTable 80 .ensureFieldAccessorsInitialized( 81 com.google.cloud.retail.v2.PredictRequest.class, 82 com.google.cloud.retail.v2.PredictRequest.Builder.class); 83 } 84 85 public static final int PLACEMENT_FIELD_NUMBER = 1; 86 87 @SuppressWarnings("serial") 88 private volatile java.lang.Object placement_ = ""; 89 /** 90 * 91 * 92 * <pre> 93 * Required. Full resource name of the format: 94 * `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` 95 * or 96 * `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. 97 * We recommend using the `servingConfigs` resource. `placements` is a legacy 98 * resource. 99 * The ID of the Recommendations AI serving config or placement. 100 * Before you can request predictions from your model, you must create at 101 * least one serving config or placement for it. For more information, see 102 * [Manage serving configs] 103 * (https://cloud.google.com/retail/docs/manage-configs). 104 * The full list of available serving configs can be seen at 105 * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs 106 * </pre> 107 * 108 * <code>string placement = 1 [(.google.api.field_behavior) = REQUIRED];</code> 109 * 110 * @return The placement. 111 */ 112 @java.lang.Override getPlacement()113 public java.lang.String getPlacement() { 114 java.lang.Object ref = placement_; 115 if (ref instanceof java.lang.String) { 116 return (java.lang.String) ref; 117 } else { 118 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 119 java.lang.String s = bs.toStringUtf8(); 120 placement_ = s; 121 return s; 122 } 123 } 124 /** 125 * 126 * 127 * <pre> 128 * Required. Full resource name of the format: 129 * `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` 130 * or 131 * `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. 132 * We recommend using the `servingConfigs` resource. `placements` is a legacy 133 * resource. 134 * The ID of the Recommendations AI serving config or placement. 135 * Before you can request predictions from your model, you must create at 136 * least one serving config or placement for it. For more information, see 137 * [Manage serving configs] 138 * (https://cloud.google.com/retail/docs/manage-configs). 139 * The full list of available serving configs can be seen at 140 * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs 141 * </pre> 142 * 143 * <code>string placement = 1 [(.google.api.field_behavior) = REQUIRED];</code> 144 * 145 * @return The bytes for placement. 146 */ 147 @java.lang.Override getPlacementBytes()148 public com.google.protobuf.ByteString getPlacementBytes() { 149 java.lang.Object ref = placement_; 150 if (ref instanceof java.lang.String) { 151 com.google.protobuf.ByteString b = 152 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 153 placement_ = b; 154 return b; 155 } else { 156 return (com.google.protobuf.ByteString) ref; 157 } 158 } 159 160 public static final int USER_EVENT_FIELD_NUMBER = 2; 161 private com.google.cloud.retail.v2.UserEvent userEvent_; 162 /** 163 * 164 * 165 * <pre> 166 * Required. Context about the user, what they are looking at and what action 167 * they took to trigger the predict request. Note that this user event detail 168 * won't be ingested to userEvent logs. Thus, a separate userEvent write 169 * request is required for event logging. 170 * Don't set 171 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 172 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 173 * fixed ID for different users. If you are trying to receive non-personalized 174 * recommendations (not recommended; this can negatively impact model 175 * performance), instead set 176 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 177 * random unique ID and leave 178 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 179 * </pre> 180 * 181 * <code> 182 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 183 * </code> 184 * 185 * @return Whether the userEvent field is set. 186 */ 187 @java.lang.Override hasUserEvent()188 public boolean hasUserEvent() { 189 return userEvent_ != null; 190 } 191 /** 192 * 193 * 194 * <pre> 195 * Required. Context about the user, what they are looking at and what action 196 * they took to trigger the predict request. Note that this user event detail 197 * won't be ingested to userEvent logs. Thus, a separate userEvent write 198 * request is required for event logging. 199 * Don't set 200 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 201 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 202 * fixed ID for different users. If you are trying to receive non-personalized 203 * recommendations (not recommended; this can negatively impact model 204 * performance), instead set 205 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 206 * random unique ID and leave 207 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 208 * </pre> 209 * 210 * <code> 211 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 212 * </code> 213 * 214 * @return The userEvent. 215 */ 216 @java.lang.Override getUserEvent()217 public com.google.cloud.retail.v2.UserEvent getUserEvent() { 218 return userEvent_ == null 219 ? com.google.cloud.retail.v2.UserEvent.getDefaultInstance() 220 : userEvent_; 221 } 222 /** 223 * 224 * 225 * <pre> 226 * Required. Context about the user, what they are looking at and what action 227 * they took to trigger the predict request. Note that this user event detail 228 * won't be ingested to userEvent logs. Thus, a separate userEvent write 229 * request is required for event logging. 230 * Don't set 231 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 232 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 233 * fixed ID for different users. If you are trying to receive non-personalized 234 * recommendations (not recommended; this can negatively impact model 235 * performance), instead set 236 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 237 * random unique ID and leave 238 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 239 * </pre> 240 * 241 * <code> 242 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 243 * </code> 244 */ 245 @java.lang.Override getUserEventOrBuilder()246 public com.google.cloud.retail.v2.UserEventOrBuilder getUserEventOrBuilder() { 247 return userEvent_ == null 248 ? com.google.cloud.retail.v2.UserEvent.getDefaultInstance() 249 : userEvent_; 250 } 251 252 public static final int PAGE_SIZE_FIELD_NUMBER = 3; 253 private int pageSize_ = 0; 254 /** 255 * 256 * 257 * <pre> 258 * Maximum number of results to return. Set this property to the number of 259 * prediction results needed. If zero, the service will choose a reasonable 260 * default. The maximum allowed value is 100. Values above 100 will be coerced 261 * to 100. 262 * </pre> 263 * 264 * <code>int32 page_size = 3;</code> 265 * 266 * @return The pageSize. 267 */ 268 @java.lang.Override getPageSize()269 public int getPageSize() { 270 return pageSize_; 271 } 272 273 public static final int PAGE_TOKEN_FIELD_NUMBER = 4; 274 275 @SuppressWarnings("serial") 276 private volatile java.lang.Object pageToken_ = ""; 277 /** 278 * 279 * 280 * <pre> 281 * This field is not used; leave it unset. 282 * </pre> 283 * 284 * <code>string page_token = 4 [deprecated = true];</code> 285 * 286 * @deprecated google.cloud.retail.v2.PredictRequest.page_token is deprecated. See 287 * google/cloud/retail/v2/prediction_service.proto;l=94 288 * @return The pageToken. 289 */ 290 @java.lang.Override 291 @java.lang.Deprecated getPageToken()292 public java.lang.String getPageToken() { 293 java.lang.Object ref = pageToken_; 294 if (ref instanceof java.lang.String) { 295 return (java.lang.String) ref; 296 } else { 297 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 298 java.lang.String s = bs.toStringUtf8(); 299 pageToken_ = s; 300 return s; 301 } 302 } 303 /** 304 * 305 * 306 * <pre> 307 * This field is not used; leave it unset. 308 * </pre> 309 * 310 * <code>string page_token = 4 [deprecated = true];</code> 311 * 312 * @deprecated google.cloud.retail.v2.PredictRequest.page_token is deprecated. See 313 * google/cloud/retail/v2/prediction_service.proto;l=94 314 * @return The bytes for pageToken. 315 */ 316 @java.lang.Override 317 @java.lang.Deprecated getPageTokenBytes()318 public com.google.protobuf.ByteString getPageTokenBytes() { 319 java.lang.Object ref = pageToken_; 320 if (ref instanceof java.lang.String) { 321 com.google.protobuf.ByteString b = 322 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 323 pageToken_ = b; 324 return b; 325 } else { 326 return (com.google.protobuf.ByteString) ref; 327 } 328 } 329 330 public static final int FILTER_FIELD_NUMBER = 5; 331 332 @SuppressWarnings("serial") 333 private volatile java.lang.Object filter_ = ""; 334 /** 335 * 336 * 337 * <pre> 338 * Filter for restricting prediction results with a length limit of 5,000 339 * characters. Accepts values for tags and the `filterOutOfStockItems` flag. 340 * * Tag expressions. Restricts predictions to products that match all of the 341 * specified tags. Boolean operators `OR` and `NOT` are supported if the 342 * expression is enclosed in parentheses, and must be separated from the 343 * tag values by a space. `-"tagA"` is also supported and is equivalent to 344 * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings 345 * with a size limit of 1,000 characters. 346 * Note: "Recently viewed" models don't support tag filtering at the 347 * moment. 348 * * filterOutOfStockItems. Restricts predictions to products that do not 349 * have a 350 * stockState value of OUT_OF_STOCK. 351 * Examples: 352 * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") 353 * * filterOutOfStockItems tag=(-"promotional") 354 * * filterOutOfStockItems 355 * If your filter blocks all prediction results, the API will return *no* 356 * results. If instead you want empty result sets to return generic 357 * (unfiltered) popular products, set `strictFiltering` to False in 358 * `PredictRequest.params`. Note that the API will never return items with 359 * storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. 360 * If `filterSyntaxV2` is set to true under the `params` field, then 361 * attribute-based expressions are expected instead of the above described 362 * tag-based syntax. Examples: 363 * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) 364 * * (availability: ANY("IN_STOCK")) AND 365 * (colors: ANY("Red") OR categories: ANY("Phones")) 366 * For more information, see 367 * [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). 368 * </pre> 369 * 370 * <code>string filter = 5;</code> 371 * 372 * @return The filter. 373 */ 374 @java.lang.Override getFilter()375 public java.lang.String getFilter() { 376 java.lang.Object ref = filter_; 377 if (ref instanceof java.lang.String) { 378 return (java.lang.String) ref; 379 } else { 380 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 381 java.lang.String s = bs.toStringUtf8(); 382 filter_ = s; 383 return s; 384 } 385 } 386 /** 387 * 388 * 389 * <pre> 390 * Filter for restricting prediction results with a length limit of 5,000 391 * characters. Accepts values for tags and the `filterOutOfStockItems` flag. 392 * * Tag expressions. Restricts predictions to products that match all of the 393 * specified tags. Boolean operators `OR` and `NOT` are supported if the 394 * expression is enclosed in parentheses, and must be separated from the 395 * tag values by a space. `-"tagA"` is also supported and is equivalent to 396 * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings 397 * with a size limit of 1,000 characters. 398 * Note: "Recently viewed" models don't support tag filtering at the 399 * moment. 400 * * filterOutOfStockItems. Restricts predictions to products that do not 401 * have a 402 * stockState value of OUT_OF_STOCK. 403 * Examples: 404 * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") 405 * * filterOutOfStockItems tag=(-"promotional") 406 * * filterOutOfStockItems 407 * If your filter blocks all prediction results, the API will return *no* 408 * results. If instead you want empty result sets to return generic 409 * (unfiltered) popular products, set `strictFiltering` to False in 410 * `PredictRequest.params`. Note that the API will never return items with 411 * storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. 412 * If `filterSyntaxV2` is set to true under the `params` field, then 413 * attribute-based expressions are expected instead of the above described 414 * tag-based syntax. Examples: 415 * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) 416 * * (availability: ANY("IN_STOCK")) AND 417 * (colors: ANY("Red") OR categories: ANY("Phones")) 418 * For more information, see 419 * [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). 420 * </pre> 421 * 422 * <code>string filter = 5;</code> 423 * 424 * @return The bytes for filter. 425 */ 426 @java.lang.Override getFilterBytes()427 public com.google.protobuf.ByteString getFilterBytes() { 428 java.lang.Object ref = filter_; 429 if (ref instanceof java.lang.String) { 430 com.google.protobuf.ByteString b = 431 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 432 filter_ = b; 433 return b; 434 } else { 435 return (com.google.protobuf.ByteString) ref; 436 } 437 } 438 439 public static final int VALIDATE_ONLY_FIELD_NUMBER = 6; 440 private boolean validateOnly_ = false; 441 /** 442 * 443 * 444 * <pre> 445 * Use validate only mode for this prediction query. If set to true, a 446 * dummy model will be used that returns arbitrary products. 447 * Note that the validate only mode should only be used for testing the API, 448 * or if the model is not ready. 449 * </pre> 450 * 451 * <code>bool validate_only = 6;</code> 452 * 453 * @return The validateOnly. 454 */ 455 @java.lang.Override getValidateOnly()456 public boolean getValidateOnly() { 457 return validateOnly_; 458 } 459 460 public static final int PARAMS_FIELD_NUMBER = 7; 461 462 private static final class ParamsDefaultEntryHolder { 463 static final com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value> 464 defaultEntry = 465 com.google.protobuf.MapEntry 466 .<java.lang.String, com.google.protobuf.Value>newDefaultInstance( 467 com.google.cloud.retail.v2.PredictionServiceProto 468 .internal_static_google_cloud_retail_v2_PredictRequest_ParamsEntry_descriptor, 469 com.google.protobuf.WireFormat.FieldType.STRING, 470 "", 471 com.google.protobuf.WireFormat.FieldType.MESSAGE, 472 com.google.protobuf.Value.getDefaultInstance()); 473 } 474 475 @SuppressWarnings("serial") 476 private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> params_; 477 478 private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> internalGetParams()479 internalGetParams() { 480 if (params_ == null) { 481 return com.google.protobuf.MapField.emptyMapField(ParamsDefaultEntryHolder.defaultEntry); 482 } 483 return params_; 484 } 485 getParamsCount()486 public int getParamsCount() { 487 return internalGetParams().getMap().size(); 488 } 489 /** 490 * 491 * 492 * <pre> 493 * Additional domain specific parameters for the predictions. 494 * Allowed values: 495 * * `returnProduct`: Boolean. If set to true, the associated product 496 * object will be returned in the `results.metadata` field in the 497 * prediction response. 498 * * `returnScore`: Boolean. If set to true, the prediction 'score' 499 * corresponding to each returned product will be set in the 500 * `results.metadata` field in the prediction response. The given 501 * 'score' indicates the probability of a product being clicked/purchased 502 * given the user's context and history. 503 * * `strictFiltering`: Boolean. True by default. If set to false, the service 504 * will return generic (unfiltered) popular products instead of empty if 505 * your filter blocks all prediction results. 506 * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then 507 * it needs to be one of {'no-price-reranking', 'low-price-reranking', 508 * 'medium-price-reranking', 'high-price-reranking'}. This gives 509 * request-level control and adjusts prediction results based on product 510 * price. 511 * * `diversityLevel`: String. Default empty. If set to be non-empty, then 512 * it needs to be one of {'no-diversity', 'low-diversity', 513 * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives 514 * request-level control and adjusts prediction results based on product 515 * category. 516 * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` 517 * field is interpreteted according to the new, attribute-based syntax. 518 * </pre> 519 * 520 * <code>map<string, .google.protobuf.Value> params = 7;</code> 521 */ 522 @java.lang.Override containsParams(java.lang.String key)523 public boolean containsParams(java.lang.String key) { 524 if (key == null) { 525 throw new NullPointerException("map key"); 526 } 527 return internalGetParams().getMap().containsKey(key); 528 } 529 /** Use {@link #getParamsMap()} instead. */ 530 @java.lang.Override 531 @java.lang.Deprecated getParams()532 public java.util.Map<java.lang.String, com.google.protobuf.Value> getParams() { 533 return getParamsMap(); 534 } 535 /** 536 * 537 * 538 * <pre> 539 * Additional domain specific parameters for the predictions. 540 * Allowed values: 541 * * `returnProduct`: Boolean. If set to true, the associated product 542 * object will be returned in the `results.metadata` field in the 543 * prediction response. 544 * * `returnScore`: Boolean. If set to true, the prediction 'score' 545 * corresponding to each returned product will be set in the 546 * `results.metadata` field in the prediction response. The given 547 * 'score' indicates the probability of a product being clicked/purchased 548 * given the user's context and history. 549 * * `strictFiltering`: Boolean. True by default. If set to false, the service 550 * will return generic (unfiltered) popular products instead of empty if 551 * your filter blocks all prediction results. 552 * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then 553 * it needs to be one of {'no-price-reranking', 'low-price-reranking', 554 * 'medium-price-reranking', 'high-price-reranking'}. This gives 555 * request-level control and adjusts prediction results based on product 556 * price. 557 * * `diversityLevel`: String. Default empty. If set to be non-empty, then 558 * it needs to be one of {'no-diversity', 'low-diversity', 559 * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives 560 * request-level control and adjusts prediction results based on product 561 * category. 562 * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` 563 * field is interpreteted according to the new, attribute-based syntax. 564 * </pre> 565 * 566 * <code>map<string, .google.protobuf.Value> params = 7;</code> 567 */ 568 @java.lang.Override getParamsMap()569 public java.util.Map<java.lang.String, com.google.protobuf.Value> getParamsMap() { 570 return internalGetParams().getMap(); 571 } 572 /** 573 * 574 * 575 * <pre> 576 * Additional domain specific parameters for the predictions. 577 * Allowed values: 578 * * `returnProduct`: Boolean. If set to true, the associated product 579 * object will be returned in the `results.metadata` field in the 580 * prediction response. 581 * * `returnScore`: Boolean. If set to true, the prediction 'score' 582 * corresponding to each returned product will be set in the 583 * `results.metadata` field in the prediction response. The given 584 * 'score' indicates the probability of a product being clicked/purchased 585 * given the user's context and history. 586 * * `strictFiltering`: Boolean. True by default. If set to false, the service 587 * will return generic (unfiltered) popular products instead of empty if 588 * your filter blocks all prediction results. 589 * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then 590 * it needs to be one of {'no-price-reranking', 'low-price-reranking', 591 * 'medium-price-reranking', 'high-price-reranking'}. This gives 592 * request-level control and adjusts prediction results based on product 593 * price. 594 * * `diversityLevel`: String. Default empty. If set to be non-empty, then 595 * it needs to be one of {'no-diversity', 'low-diversity', 596 * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives 597 * request-level control and adjusts prediction results based on product 598 * category. 599 * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` 600 * field is interpreteted according to the new, attribute-based syntax. 601 * </pre> 602 * 603 * <code>map<string, .google.protobuf.Value> params = 7;</code> 604 */ 605 @java.lang.Override getParamsOrDefault( java.lang.String key, com.google.protobuf.Value defaultValue)606 public /* nullable */ com.google.protobuf.Value getParamsOrDefault( 607 java.lang.String key, 608 /* nullable */ 609 com.google.protobuf.Value defaultValue) { 610 if (key == null) { 611 throw new NullPointerException("map key"); 612 } 613 java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetParams().getMap(); 614 return map.containsKey(key) ? map.get(key) : defaultValue; 615 } 616 /** 617 * 618 * 619 * <pre> 620 * Additional domain specific parameters for the predictions. 621 * Allowed values: 622 * * `returnProduct`: Boolean. If set to true, the associated product 623 * object will be returned in the `results.metadata` field in the 624 * prediction response. 625 * * `returnScore`: Boolean. If set to true, the prediction 'score' 626 * corresponding to each returned product will be set in the 627 * `results.metadata` field in the prediction response. The given 628 * 'score' indicates the probability of a product being clicked/purchased 629 * given the user's context and history. 630 * * `strictFiltering`: Boolean. True by default. If set to false, the service 631 * will return generic (unfiltered) popular products instead of empty if 632 * your filter blocks all prediction results. 633 * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then 634 * it needs to be one of {'no-price-reranking', 'low-price-reranking', 635 * 'medium-price-reranking', 'high-price-reranking'}. This gives 636 * request-level control and adjusts prediction results based on product 637 * price. 638 * * `diversityLevel`: String. Default empty. If set to be non-empty, then 639 * it needs to be one of {'no-diversity', 'low-diversity', 640 * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives 641 * request-level control and adjusts prediction results based on product 642 * category. 643 * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` 644 * field is interpreteted according to the new, attribute-based syntax. 645 * </pre> 646 * 647 * <code>map<string, .google.protobuf.Value> params = 7;</code> 648 */ 649 @java.lang.Override getParamsOrThrow(java.lang.String key)650 public com.google.protobuf.Value getParamsOrThrow(java.lang.String key) { 651 if (key == null) { 652 throw new NullPointerException("map key"); 653 } 654 java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetParams().getMap(); 655 if (!map.containsKey(key)) { 656 throw new java.lang.IllegalArgumentException(); 657 } 658 return map.get(key); 659 } 660 661 public static final int LABELS_FIELD_NUMBER = 8; 662 663 private static final class LabelsDefaultEntryHolder { 664 static final com.google.protobuf.MapEntry<java.lang.String, java.lang.String> defaultEntry = 665 com.google.protobuf.MapEntry.<java.lang.String, java.lang.String>newDefaultInstance( 666 com.google.cloud.retail.v2.PredictionServiceProto 667 .internal_static_google_cloud_retail_v2_PredictRequest_LabelsEntry_descriptor, 668 com.google.protobuf.WireFormat.FieldType.STRING, 669 "", 670 com.google.protobuf.WireFormat.FieldType.STRING, 671 ""); 672 } 673 674 @SuppressWarnings("serial") 675 private com.google.protobuf.MapField<java.lang.String, java.lang.String> labels_; 676 internalGetLabels()677 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() { 678 if (labels_ == null) { 679 return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); 680 } 681 return labels_; 682 } 683 getLabelsCount()684 public int getLabelsCount() { 685 return internalGetLabels().getMap().size(); 686 } 687 /** 688 * 689 * 690 * <pre> 691 * The labels applied to a resource must meet the following requirements: 692 * * Each resource can have multiple labels, up to a maximum of 64. 693 * * Each label must be a key-value pair. 694 * * Keys have a minimum length of 1 character and a maximum length of 63 695 * characters and cannot be empty. Values can be empty and have a maximum 696 * length of 63 characters. 697 * * Keys and values can contain only lowercase letters, numeric characters, 698 * underscores, and dashes. All characters must use UTF-8 encoding, and 699 * international characters are allowed. 700 * * The key portion of a label must be unique. However, you can use the same 701 * key with multiple resources. 702 * * Keys must start with a lowercase letter or international character. 703 * See [Google Cloud 704 * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) 705 * for more details. 706 * </pre> 707 * 708 * <code>map<string, string> labels = 8;</code> 709 */ 710 @java.lang.Override containsLabels(java.lang.String key)711 public boolean containsLabels(java.lang.String key) { 712 if (key == null) { 713 throw new NullPointerException("map key"); 714 } 715 return internalGetLabels().getMap().containsKey(key); 716 } 717 /** Use {@link #getLabelsMap()} instead. */ 718 @java.lang.Override 719 @java.lang.Deprecated getLabels()720 public java.util.Map<java.lang.String, java.lang.String> getLabels() { 721 return getLabelsMap(); 722 } 723 /** 724 * 725 * 726 * <pre> 727 * The labels applied to a resource must meet the following requirements: 728 * * Each resource can have multiple labels, up to a maximum of 64. 729 * * Each label must be a key-value pair. 730 * * Keys have a minimum length of 1 character and a maximum length of 63 731 * characters and cannot be empty. Values can be empty and have a maximum 732 * length of 63 characters. 733 * * Keys and values can contain only lowercase letters, numeric characters, 734 * underscores, and dashes. All characters must use UTF-8 encoding, and 735 * international characters are allowed. 736 * * The key portion of a label must be unique. However, you can use the same 737 * key with multiple resources. 738 * * Keys must start with a lowercase letter or international character. 739 * See [Google Cloud 740 * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) 741 * for more details. 742 * </pre> 743 * 744 * <code>map<string, string> labels = 8;</code> 745 */ 746 @java.lang.Override getLabelsMap()747 public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() { 748 return internalGetLabels().getMap(); 749 } 750 /** 751 * 752 * 753 * <pre> 754 * The labels applied to a resource must meet the following requirements: 755 * * Each resource can have multiple labels, up to a maximum of 64. 756 * * Each label must be a key-value pair. 757 * * Keys have a minimum length of 1 character and a maximum length of 63 758 * characters and cannot be empty. Values can be empty and have a maximum 759 * length of 63 characters. 760 * * Keys and values can contain only lowercase letters, numeric characters, 761 * underscores, and dashes. All characters must use UTF-8 encoding, and 762 * international characters are allowed. 763 * * The key portion of a label must be unique. However, you can use the same 764 * key with multiple resources. 765 * * Keys must start with a lowercase letter or international character. 766 * See [Google Cloud 767 * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) 768 * for more details. 769 * </pre> 770 * 771 * <code>map<string, string> labels = 8;</code> 772 */ 773 @java.lang.Override getLabelsOrDefault( java.lang.String key, java.lang.String defaultValue)774 public /* nullable */ java.lang.String getLabelsOrDefault( 775 java.lang.String key, 776 /* nullable */ 777 java.lang.String defaultValue) { 778 if (key == null) { 779 throw new NullPointerException("map key"); 780 } 781 java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap(); 782 return map.containsKey(key) ? map.get(key) : defaultValue; 783 } 784 /** 785 * 786 * 787 * <pre> 788 * The labels applied to a resource must meet the following requirements: 789 * * Each resource can have multiple labels, up to a maximum of 64. 790 * * Each label must be a key-value pair. 791 * * Keys have a minimum length of 1 character and a maximum length of 63 792 * characters and cannot be empty. Values can be empty and have a maximum 793 * length of 63 characters. 794 * * Keys and values can contain only lowercase letters, numeric characters, 795 * underscores, and dashes. All characters must use UTF-8 encoding, and 796 * international characters are allowed. 797 * * The key portion of a label must be unique. However, you can use the same 798 * key with multiple resources. 799 * * Keys must start with a lowercase letter or international character. 800 * See [Google Cloud 801 * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) 802 * for more details. 803 * </pre> 804 * 805 * <code>map<string, string> labels = 8;</code> 806 */ 807 @java.lang.Override getLabelsOrThrow(java.lang.String key)808 public java.lang.String getLabelsOrThrow(java.lang.String key) { 809 if (key == null) { 810 throw new NullPointerException("map key"); 811 } 812 java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap(); 813 if (!map.containsKey(key)) { 814 throw new java.lang.IllegalArgumentException(); 815 } 816 return map.get(key); 817 } 818 819 private byte memoizedIsInitialized = -1; 820 821 @java.lang.Override isInitialized()822 public final boolean isInitialized() { 823 byte isInitialized = memoizedIsInitialized; 824 if (isInitialized == 1) return true; 825 if (isInitialized == 0) return false; 826 827 memoizedIsInitialized = 1; 828 return true; 829 } 830 831 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)832 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 833 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(placement_)) { 834 com.google.protobuf.GeneratedMessageV3.writeString(output, 1, placement_); 835 } 836 if (userEvent_ != null) { 837 output.writeMessage(2, getUserEvent()); 838 } 839 if (pageSize_ != 0) { 840 output.writeInt32(3, pageSize_); 841 } 842 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { 843 com.google.protobuf.GeneratedMessageV3.writeString(output, 4, pageToken_); 844 } 845 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { 846 com.google.protobuf.GeneratedMessageV3.writeString(output, 5, filter_); 847 } 848 if (validateOnly_ != false) { 849 output.writeBool(6, validateOnly_); 850 } 851 com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( 852 output, internalGetParams(), ParamsDefaultEntryHolder.defaultEntry, 7); 853 com.google.protobuf.GeneratedMessageV3.serializeStringMapTo( 854 output, internalGetLabels(), LabelsDefaultEntryHolder.defaultEntry, 8); 855 getUnknownFields().writeTo(output); 856 } 857 858 @java.lang.Override getSerializedSize()859 public int getSerializedSize() { 860 int size = memoizedSize; 861 if (size != -1) return size; 862 863 size = 0; 864 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(placement_)) { 865 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, placement_); 866 } 867 if (userEvent_ != null) { 868 size += com.google.protobuf.CodedOutputStream.computeMessageSize(2, getUserEvent()); 869 } 870 if (pageSize_ != 0) { 871 size += com.google.protobuf.CodedOutputStream.computeInt32Size(3, pageSize_); 872 } 873 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(pageToken_)) { 874 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, pageToken_); 875 } 876 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(filter_)) { 877 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(5, filter_); 878 } 879 if (validateOnly_ != false) { 880 size += com.google.protobuf.CodedOutputStream.computeBoolSize(6, validateOnly_); 881 } 882 for (java.util.Map.Entry<java.lang.String, com.google.protobuf.Value> entry : 883 internalGetParams().getMap().entrySet()) { 884 com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value> params__ = 885 ParamsDefaultEntryHolder.defaultEntry 886 .newBuilderForType() 887 .setKey(entry.getKey()) 888 .setValue(entry.getValue()) 889 .build(); 890 size += com.google.protobuf.CodedOutputStream.computeMessageSize(7, params__); 891 } 892 for (java.util.Map.Entry<java.lang.String, java.lang.String> entry : 893 internalGetLabels().getMap().entrySet()) { 894 com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ = 895 LabelsDefaultEntryHolder.defaultEntry 896 .newBuilderForType() 897 .setKey(entry.getKey()) 898 .setValue(entry.getValue()) 899 .build(); 900 size += com.google.protobuf.CodedOutputStream.computeMessageSize(8, labels__); 901 } 902 size += getUnknownFields().getSerializedSize(); 903 memoizedSize = size; 904 return size; 905 } 906 907 @java.lang.Override equals(final java.lang.Object obj)908 public boolean equals(final java.lang.Object obj) { 909 if (obj == this) { 910 return true; 911 } 912 if (!(obj instanceof com.google.cloud.retail.v2.PredictRequest)) { 913 return super.equals(obj); 914 } 915 com.google.cloud.retail.v2.PredictRequest other = 916 (com.google.cloud.retail.v2.PredictRequest) obj; 917 918 if (!getPlacement().equals(other.getPlacement())) return false; 919 if (hasUserEvent() != other.hasUserEvent()) return false; 920 if (hasUserEvent()) { 921 if (!getUserEvent().equals(other.getUserEvent())) return false; 922 } 923 if (getPageSize() != other.getPageSize()) return false; 924 if (!getPageToken().equals(other.getPageToken())) return false; 925 if (!getFilter().equals(other.getFilter())) return false; 926 if (getValidateOnly() != other.getValidateOnly()) return false; 927 if (!internalGetParams().equals(other.internalGetParams())) return false; 928 if (!internalGetLabels().equals(other.internalGetLabels())) return false; 929 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 930 return true; 931 } 932 933 @java.lang.Override hashCode()934 public int hashCode() { 935 if (memoizedHashCode != 0) { 936 return memoizedHashCode; 937 } 938 int hash = 41; 939 hash = (19 * hash) + getDescriptor().hashCode(); 940 hash = (37 * hash) + PLACEMENT_FIELD_NUMBER; 941 hash = (53 * hash) + getPlacement().hashCode(); 942 if (hasUserEvent()) { 943 hash = (37 * hash) + USER_EVENT_FIELD_NUMBER; 944 hash = (53 * hash) + getUserEvent().hashCode(); 945 } 946 hash = (37 * hash) + PAGE_SIZE_FIELD_NUMBER; 947 hash = (53 * hash) + getPageSize(); 948 hash = (37 * hash) + PAGE_TOKEN_FIELD_NUMBER; 949 hash = (53 * hash) + getPageToken().hashCode(); 950 hash = (37 * hash) + FILTER_FIELD_NUMBER; 951 hash = (53 * hash) + getFilter().hashCode(); 952 hash = (37 * hash) + VALIDATE_ONLY_FIELD_NUMBER; 953 hash = (53 * hash) + com.google.protobuf.Internal.hashBoolean(getValidateOnly()); 954 if (!internalGetParams().getMap().isEmpty()) { 955 hash = (37 * hash) + PARAMS_FIELD_NUMBER; 956 hash = (53 * hash) + internalGetParams().hashCode(); 957 } 958 if (!internalGetLabels().getMap().isEmpty()) { 959 hash = (37 * hash) + LABELS_FIELD_NUMBER; 960 hash = (53 * hash) + internalGetLabels().hashCode(); 961 } 962 hash = (29 * hash) + getUnknownFields().hashCode(); 963 memoizedHashCode = hash; 964 return hash; 965 } 966 parseFrom(java.nio.ByteBuffer data)967 public static com.google.cloud.retail.v2.PredictRequest parseFrom(java.nio.ByteBuffer data) 968 throws com.google.protobuf.InvalidProtocolBufferException { 969 return PARSER.parseFrom(data); 970 } 971 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)972 public static com.google.cloud.retail.v2.PredictRequest parseFrom( 973 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 974 throws com.google.protobuf.InvalidProtocolBufferException { 975 return PARSER.parseFrom(data, extensionRegistry); 976 } 977 parseFrom( com.google.protobuf.ByteString data)978 public static com.google.cloud.retail.v2.PredictRequest parseFrom( 979 com.google.protobuf.ByteString data) 980 throws com.google.protobuf.InvalidProtocolBufferException { 981 return PARSER.parseFrom(data); 982 } 983 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)984 public static com.google.cloud.retail.v2.PredictRequest parseFrom( 985 com.google.protobuf.ByteString data, 986 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 987 throws com.google.protobuf.InvalidProtocolBufferException { 988 return PARSER.parseFrom(data, extensionRegistry); 989 } 990 parseFrom(byte[] data)991 public static com.google.cloud.retail.v2.PredictRequest parseFrom(byte[] data) 992 throws com.google.protobuf.InvalidProtocolBufferException { 993 return PARSER.parseFrom(data); 994 } 995 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)996 public static com.google.cloud.retail.v2.PredictRequest parseFrom( 997 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 998 throws com.google.protobuf.InvalidProtocolBufferException { 999 return PARSER.parseFrom(data, extensionRegistry); 1000 } 1001 parseFrom(java.io.InputStream input)1002 public static com.google.cloud.retail.v2.PredictRequest parseFrom(java.io.InputStream input) 1003 throws java.io.IOException { 1004 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 1005 } 1006 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1007 public static com.google.cloud.retail.v2.PredictRequest parseFrom( 1008 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1009 throws java.io.IOException { 1010 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 1011 PARSER, input, extensionRegistry); 1012 } 1013 parseDelimitedFrom( java.io.InputStream input)1014 public static com.google.cloud.retail.v2.PredictRequest parseDelimitedFrom( 1015 java.io.InputStream input) throws java.io.IOException { 1016 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 1017 } 1018 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1019 public static com.google.cloud.retail.v2.PredictRequest parseDelimitedFrom( 1020 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1021 throws java.io.IOException { 1022 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 1023 PARSER, input, extensionRegistry); 1024 } 1025 parseFrom( com.google.protobuf.CodedInputStream input)1026 public static com.google.cloud.retail.v2.PredictRequest parseFrom( 1027 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 1028 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 1029 } 1030 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1031 public static com.google.cloud.retail.v2.PredictRequest parseFrom( 1032 com.google.protobuf.CodedInputStream input, 1033 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1034 throws java.io.IOException { 1035 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 1036 PARSER, input, extensionRegistry); 1037 } 1038 1039 @java.lang.Override newBuilderForType()1040 public Builder newBuilderForType() { 1041 return newBuilder(); 1042 } 1043 newBuilder()1044 public static Builder newBuilder() { 1045 return DEFAULT_INSTANCE.toBuilder(); 1046 } 1047 newBuilder(com.google.cloud.retail.v2.PredictRequest prototype)1048 public static Builder newBuilder(com.google.cloud.retail.v2.PredictRequest prototype) { 1049 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 1050 } 1051 1052 @java.lang.Override toBuilder()1053 public Builder toBuilder() { 1054 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 1055 } 1056 1057 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)1058 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 1059 Builder builder = new Builder(parent); 1060 return builder; 1061 } 1062 /** 1063 * 1064 * 1065 * <pre> 1066 * Request message for Predict method. 1067 * </pre> 1068 * 1069 * Protobuf type {@code google.cloud.retail.v2.PredictRequest} 1070 */ 1071 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 1072 implements 1073 // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.PredictRequest) 1074 com.google.cloud.retail.v2.PredictRequestOrBuilder { getDescriptor()1075 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 1076 return com.google.cloud.retail.v2.PredictionServiceProto 1077 .internal_static_google_cloud_retail_v2_PredictRequest_descriptor; 1078 } 1079 1080 @SuppressWarnings({"rawtypes"}) internalGetMapField(int number)1081 protected com.google.protobuf.MapField internalGetMapField(int number) { 1082 switch (number) { 1083 case 7: 1084 return internalGetParams(); 1085 case 8: 1086 return internalGetLabels(); 1087 default: 1088 throw new RuntimeException("Invalid map field number: " + number); 1089 } 1090 } 1091 1092 @SuppressWarnings({"rawtypes"}) internalGetMutableMapField(int number)1093 protected com.google.protobuf.MapField internalGetMutableMapField(int number) { 1094 switch (number) { 1095 case 7: 1096 return internalGetMutableParams(); 1097 case 8: 1098 return internalGetMutableLabels(); 1099 default: 1100 throw new RuntimeException("Invalid map field number: " + number); 1101 } 1102 } 1103 1104 @java.lang.Override 1105 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()1106 internalGetFieldAccessorTable() { 1107 return com.google.cloud.retail.v2.PredictionServiceProto 1108 .internal_static_google_cloud_retail_v2_PredictRequest_fieldAccessorTable 1109 .ensureFieldAccessorsInitialized( 1110 com.google.cloud.retail.v2.PredictRequest.class, 1111 com.google.cloud.retail.v2.PredictRequest.Builder.class); 1112 } 1113 1114 // Construct using com.google.cloud.retail.v2.PredictRequest.newBuilder() Builder()1115 private Builder() {} 1116 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)1117 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 1118 super(parent); 1119 } 1120 1121 @java.lang.Override clear()1122 public Builder clear() { 1123 super.clear(); 1124 bitField0_ = 0; 1125 placement_ = ""; 1126 userEvent_ = null; 1127 if (userEventBuilder_ != null) { 1128 userEventBuilder_.dispose(); 1129 userEventBuilder_ = null; 1130 } 1131 pageSize_ = 0; 1132 pageToken_ = ""; 1133 filter_ = ""; 1134 validateOnly_ = false; 1135 internalGetMutableParams().clear(); 1136 internalGetMutableLabels().clear(); 1137 return this; 1138 } 1139 1140 @java.lang.Override getDescriptorForType()1141 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 1142 return com.google.cloud.retail.v2.PredictionServiceProto 1143 .internal_static_google_cloud_retail_v2_PredictRequest_descriptor; 1144 } 1145 1146 @java.lang.Override getDefaultInstanceForType()1147 public com.google.cloud.retail.v2.PredictRequest getDefaultInstanceForType() { 1148 return com.google.cloud.retail.v2.PredictRequest.getDefaultInstance(); 1149 } 1150 1151 @java.lang.Override build()1152 public com.google.cloud.retail.v2.PredictRequest build() { 1153 com.google.cloud.retail.v2.PredictRequest result = buildPartial(); 1154 if (!result.isInitialized()) { 1155 throw newUninitializedMessageException(result); 1156 } 1157 return result; 1158 } 1159 1160 @java.lang.Override buildPartial()1161 public com.google.cloud.retail.v2.PredictRequest buildPartial() { 1162 com.google.cloud.retail.v2.PredictRequest result = 1163 new com.google.cloud.retail.v2.PredictRequest(this); 1164 if (bitField0_ != 0) { 1165 buildPartial0(result); 1166 } 1167 onBuilt(); 1168 return result; 1169 } 1170 buildPartial0(com.google.cloud.retail.v2.PredictRequest result)1171 private void buildPartial0(com.google.cloud.retail.v2.PredictRequest result) { 1172 int from_bitField0_ = bitField0_; 1173 if (((from_bitField0_ & 0x00000001) != 0)) { 1174 result.placement_ = placement_; 1175 } 1176 if (((from_bitField0_ & 0x00000002) != 0)) { 1177 result.userEvent_ = userEventBuilder_ == null ? userEvent_ : userEventBuilder_.build(); 1178 } 1179 if (((from_bitField0_ & 0x00000004) != 0)) { 1180 result.pageSize_ = pageSize_; 1181 } 1182 if (((from_bitField0_ & 0x00000008) != 0)) { 1183 result.pageToken_ = pageToken_; 1184 } 1185 if (((from_bitField0_ & 0x00000010) != 0)) { 1186 result.filter_ = filter_; 1187 } 1188 if (((from_bitField0_ & 0x00000020) != 0)) { 1189 result.validateOnly_ = validateOnly_; 1190 } 1191 if (((from_bitField0_ & 0x00000040) != 0)) { 1192 result.params_ = internalGetParams(); 1193 result.params_.makeImmutable(); 1194 } 1195 if (((from_bitField0_ & 0x00000080) != 0)) { 1196 result.labels_ = internalGetLabels(); 1197 result.labels_.makeImmutable(); 1198 } 1199 } 1200 1201 @java.lang.Override clone()1202 public Builder clone() { 1203 return super.clone(); 1204 } 1205 1206 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)1207 public Builder setField( 1208 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 1209 return super.setField(field, value); 1210 } 1211 1212 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)1213 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 1214 return super.clearField(field); 1215 } 1216 1217 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)1218 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 1219 return super.clearOneof(oneof); 1220 } 1221 1222 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)1223 public Builder setRepeatedField( 1224 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 1225 return super.setRepeatedField(field, index, value); 1226 } 1227 1228 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)1229 public Builder addRepeatedField( 1230 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 1231 return super.addRepeatedField(field, value); 1232 } 1233 1234 @java.lang.Override mergeFrom(com.google.protobuf.Message other)1235 public Builder mergeFrom(com.google.protobuf.Message other) { 1236 if (other instanceof com.google.cloud.retail.v2.PredictRequest) { 1237 return mergeFrom((com.google.cloud.retail.v2.PredictRequest) other); 1238 } else { 1239 super.mergeFrom(other); 1240 return this; 1241 } 1242 } 1243 mergeFrom(com.google.cloud.retail.v2.PredictRequest other)1244 public Builder mergeFrom(com.google.cloud.retail.v2.PredictRequest other) { 1245 if (other == com.google.cloud.retail.v2.PredictRequest.getDefaultInstance()) return this; 1246 if (!other.getPlacement().isEmpty()) { 1247 placement_ = other.placement_; 1248 bitField0_ |= 0x00000001; 1249 onChanged(); 1250 } 1251 if (other.hasUserEvent()) { 1252 mergeUserEvent(other.getUserEvent()); 1253 } 1254 if (other.getPageSize() != 0) { 1255 setPageSize(other.getPageSize()); 1256 } 1257 if (!other.getPageToken().isEmpty()) { 1258 pageToken_ = other.pageToken_; 1259 bitField0_ |= 0x00000008; 1260 onChanged(); 1261 } 1262 if (!other.getFilter().isEmpty()) { 1263 filter_ = other.filter_; 1264 bitField0_ |= 0x00000010; 1265 onChanged(); 1266 } 1267 if (other.getValidateOnly() != false) { 1268 setValidateOnly(other.getValidateOnly()); 1269 } 1270 internalGetMutableParams().mergeFrom(other.internalGetParams()); 1271 bitField0_ |= 0x00000040; 1272 internalGetMutableLabels().mergeFrom(other.internalGetLabels()); 1273 bitField0_ |= 0x00000080; 1274 this.mergeUnknownFields(other.getUnknownFields()); 1275 onChanged(); 1276 return this; 1277 } 1278 1279 @java.lang.Override isInitialized()1280 public final boolean isInitialized() { 1281 return true; 1282 } 1283 1284 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1285 public Builder mergeFrom( 1286 com.google.protobuf.CodedInputStream input, 1287 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1288 throws java.io.IOException { 1289 if (extensionRegistry == null) { 1290 throw new java.lang.NullPointerException(); 1291 } 1292 try { 1293 boolean done = false; 1294 while (!done) { 1295 int tag = input.readTag(); 1296 switch (tag) { 1297 case 0: 1298 done = true; 1299 break; 1300 case 10: 1301 { 1302 placement_ = input.readStringRequireUtf8(); 1303 bitField0_ |= 0x00000001; 1304 break; 1305 } // case 10 1306 case 18: 1307 { 1308 input.readMessage(getUserEventFieldBuilder().getBuilder(), extensionRegistry); 1309 bitField0_ |= 0x00000002; 1310 break; 1311 } // case 18 1312 case 24: 1313 { 1314 pageSize_ = input.readInt32(); 1315 bitField0_ |= 0x00000004; 1316 break; 1317 } // case 24 1318 case 34: 1319 { 1320 pageToken_ = input.readStringRequireUtf8(); 1321 bitField0_ |= 0x00000008; 1322 break; 1323 } // case 34 1324 case 42: 1325 { 1326 filter_ = input.readStringRequireUtf8(); 1327 bitField0_ |= 0x00000010; 1328 break; 1329 } // case 42 1330 case 48: 1331 { 1332 validateOnly_ = input.readBool(); 1333 bitField0_ |= 0x00000020; 1334 break; 1335 } // case 48 1336 case 58: 1337 { 1338 com.google.protobuf.MapEntry<java.lang.String, com.google.protobuf.Value> params__ = 1339 input.readMessage( 1340 ParamsDefaultEntryHolder.defaultEntry.getParserForType(), 1341 extensionRegistry); 1342 internalGetMutableParams() 1343 .getMutableMap() 1344 .put(params__.getKey(), params__.getValue()); 1345 bitField0_ |= 0x00000040; 1346 break; 1347 } // case 58 1348 case 66: 1349 { 1350 com.google.protobuf.MapEntry<java.lang.String, java.lang.String> labels__ = 1351 input.readMessage( 1352 LabelsDefaultEntryHolder.defaultEntry.getParserForType(), 1353 extensionRegistry); 1354 internalGetMutableLabels() 1355 .getMutableMap() 1356 .put(labels__.getKey(), labels__.getValue()); 1357 bitField0_ |= 0x00000080; 1358 break; 1359 } // case 66 1360 default: 1361 { 1362 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 1363 done = true; // was an endgroup tag 1364 } 1365 break; 1366 } // default: 1367 } // switch (tag) 1368 } // while (!done) 1369 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1370 throw e.unwrapIOException(); 1371 } finally { 1372 onChanged(); 1373 } // finally 1374 return this; 1375 } 1376 1377 private int bitField0_; 1378 1379 private java.lang.Object placement_ = ""; 1380 /** 1381 * 1382 * 1383 * <pre> 1384 * Required. Full resource name of the format: 1385 * `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` 1386 * or 1387 * `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. 1388 * We recommend using the `servingConfigs` resource. `placements` is a legacy 1389 * resource. 1390 * The ID of the Recommendations AI serving config or placement. 1391 * Before you can request predictions from your model, you must create at 1392 * least one serving config or placement for it. For more information, see 1393 * [Manage serving configs] 1394 * (https://cloud.google.com/retail/docs/manage-configs). 1395 * The full list of available serving configs can be seen at 1396 * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs 1397 * </pre> 1398 * 1399 * <code>string placement = 1 [(.google.api.field_behavior) = REQUIRED];</code> 1400 * 1401 * @return The placement. 1402 */ getPlacement()1403 public java.lang.String getPlacement() { 1404 java.lang.Object ref = placement_; 1405 if (!(ref instanceof java.lang.String)) { 1406 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1407 java.lang.String s = bs.toStringUtf8(); 1408 placement_ = s; 1409 return s; 1410 } else { 1411 return (java.lang.String) ref; 1412 } 1413 } 1414 /** 1415 * 1416 * 1417 * <pre> 1418 * Required. Full resource name of the format: 1419 * `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` 1420 * or 1421 * `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. 1422 * We recommend using the `servingConfigs` resource. `placements` is a legacy 1423 * resource. 1424 * The ID of the Recommendations AI serving config or placement. 1425 * Before you can request predictions from your model, you must create at 1426 * least one serving config or placement for it. For more information, see 1427 * [Manage serving configs] 1428 * (https://cloud.google.com/retail/docs/manage-configs). 1429 * The full list of available serving configs can be seen at 1430 * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs 1431 * </pre> 1432 * 1433 * <code>string placement = 1 [(.google.api.field_behavior) = REQUIRED];</code> 1434 * 1435 * @return The bytes for placement. 1436 */ getPlacementBytes()1437 public com.google.protobuf.ByteString getPlacementBytes() { 1438 java.lang.Object ref = placement_; 1439 if (ref instanceof String) { 1440 com.google.protobuf.ByteString b = 1441 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1442 placement_ = b; 1443 return b; 1444 } else { 1445 return (com.google.protobuf.ByteString) ref; 1446 } 1447 } 1448 /** 1449 * 1450 * 1451 * <pre> 1452 * Required. Full resource name of the format: 1453 * `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` 1454 * or 1455 * `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. 1456 * We recommend using the `servingConfigs` resource. `placements` is a legacy 1457 * resource. 1458 * The ID of the Recommendations AI serving config or placement. 1459 * Before you can request predictions from your model, you must create at 1460 * least one serving config or placement for it. For more information, see 1461 * [Manage serving configs] 1462 * (https://cloud.google.com/retail/docs/manage-configs). 1463 * The full list of available serving configs can be seen at 1464 * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs 1465 * </pre> 1466 * 1467 * <code>string placement = 1 [(.google.api.field_behavior) = REQUIRED];</code> 1468 * 1469 * @param value The placement to set. 1470 * @return This builder for chaining. 1471 */ setPlacement(java.lang.String value)1472 public Builder setPlacement(java.lang.String value) { 1473 if (value == null) { 1474 throw new NullPointerException(); 1475 } 1476 placement_ = value; 1477 bitField0_ |= 0x00000001; 1478 onChanged(); 1479 return this; 1480 } 1481 /** 1482 * 1483 * 1484 * <pre> 1485 * Required. Full resource name of the format: 1486 * `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` 1487 * or 1488 * `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. 1489 * We recommend using the `servingConfigs` resource. `placements` is a legacy 1490 * resource. 1491 * The ID of the Recommendations AI serving config or placement. 1492 * Before you can request predictions from your model, you must create at 1493 * least one serving config or placement for it. For more information, see 1494 * [Manage serving configs] 1495 * (https://cloud.google.com/retail/docs/manage-configs). 1496 * The full list of available serving configs can be seen at 1497 * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs 1498 * </pre> 1499 * 1500 * <code>string placement = 1 [(.google.api.field_behavior) = REQUIRED];</code> 1501 * 1502 * @return This builder for chaining. 1503 */ clearPlacement()1504 public Builder clearPlacement() { 1505 placement_ = getDefaultInstance().getPlacement(); 1506 bitField0_ = (bitField0_ & ~0x00000001); 1507 onChanged(); 1508 return this; 1509 } 1510 /** 1511 * 1512 * 1513 * <pre> 1514 * Required. Full resource name of the format: 1515 * `{placement=projects/*/locations/global/catalogs/default_catalog/servingConfigs/*}` 1516 * or 1517 * `{placement=projects/*/locations/global/catalogs/default_catalog/placements/*}`. 1518 * We recommend using the `servingConfigs` resource. `placements` is a legacy 1519 * resource. 1520 * The ID of the Recommendations AI serving config or placement. 1521 * Before you can request predictions from your model, you must create at 1522 * least one serving config or placement for it. For more information, see 1523 * [Manage serving configs] 1524 * (https://cloud.google.com/retail/docs/manage-configs). 1525 * The full list of available serving configs can be seen at 1526 * https://console.cloud.google.com/ai/retail/catalogs/default_catalog/configs 1527 * </pre> 1528 * 1529 * <code>string placement = 1 [(.google.api.field_behavior) = REQUIRED];</code> 1530 * 1531 * @param value The bytes for placement to set. 1532 * @return This builder for chaining. 1533 */ setPlacementBytes(com.google.protobuf.ByteString value)1534 public Builder setPlacementBytes(com.google.protobuf.ByteString value) { 1535 if (value == null) { 1536 throw new NullPointerException(); 1537 } 1538 checkByteStringIsUtf8(value); 1539 placement_ = value; 1540 bitField0_ |= 0x00000001; 1541 onChanged(); 1542 return this; 1543 } 1544 1545 private com.google.cloud.retail.v2.UserEvent userEvent_; 1546 private com.google.protobuf.SingleFieldBuilderV3< 1547 com.google.cloud.retail.v2.UserEvent, 1548 com.google.cloud.retail.v2.UserEvent.Builder, 1549 com.google.cloud.retail.v2.UserEventOrBuilder> 1550 userEventBuilder_; 1551 /** 1552 * 1553 * 1554 * <pre> 1555 * Required. Context about the user, what they are looking at and what action 1556 * they took to trigger the predict request. Note that this user event detail 1557 * won't be ingested to userEvent logs. Thus, a separate userEvent write 1558 * request is required for event logging. 1559 * Don't set 1560 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 1561 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 1562 * fixed ID for different users. If you are trying to receive non-personalized 1563 * recommendations (not recommended; this can negatively impact model 1564 * performance), instead set 1565 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 1566 * random unique ID and leave 1567 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 1568 * </pre> 1569 * 1570 * <code> 1571 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 1572 * </code> 1573 * 1574 * @return Whether the userEvent field is set. 1575 */ hasUserEvent()1576 public boolean hasUserEvent() { 1577 return ((bitField0_ & 0x00000002) != 0); 1578 } 1579 /** 1580 * 1581 * 1582 * <pre> 1583 * Required. Context about the user, what they are looking at and what action 1584 * they took to trigger the predict request. Note that this user event detail 1585 * won't be ingested to userEvent logs. Thus, a separate userEvent write 1586 * request is required for event logging. 1587 * Don't set 1588 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 1589 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 1590 * fixed ID for different users. If you are trying to receive non-personalized 1591 * recommendations (not recommended; this can negatively impact model 1592 * performance), instead set 1593 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 1594 * random unique ID and leave 1595 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 1596 * </pre> 1597 * 1598 * <code> 1599 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 1600 * </code> 1601 * 1602 * @return The userEvent. 1603 */ getUserEvent()1604 public com.google.cloud.retail.v2.UserEvent getUserEvent() { 1605 if (userEventBuilder_ == null) { 1606 return userEvent_ == null 1607 ? com.google.cloud.retail.v2.UserEvent.getDefaultInstance() 1608 : userEvent_; 1609 } else { 1610 return userEventBuilder_.getMessage(); 1611 } 1612 } 1613 /** 1614 * 1615 * 1616 * <pre> 1617 * Required. Context about the user, what they are looking at and what action 1618 * they took to trigger the predict request. Note that this user event detail 1619 * won't be ingested to userEvent logs. Thus, a separate userEvent write 1620 * request is required for event logging. 1621 * Don't set 1622 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 1623 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 1624 * fixed ID for different users. If you are trying to receive non-personalized 1625 * recommendations (not recommended; this can negatively impact model 1626 * performance), instead set 1627 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 1628 * random unique ID and leave 1629 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 1630 * </pre> 1631 * 1632 * <code> 1633 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 1634 * </code> 1635 */ setUserEvent(com.google.cloud.retail.v2.UserEvent value)1636 public Builder setUserEvent(com.google.cloud.retail.v2.UserEvent value) { 1637 if (userEventBuilder_ == null) { 1638 if (value == null) { 1639 throw new NullPointerException(); 1640 } 1641 userEvent_ = value; 1642 } else { 1643 userEventBuilder_.setMessage(value); 1644 } 1645 bitField0_ |= 0x00000002; 1646 onChanged(); 1647 return this; 1648 } 1649 /** 1650 * 1651 * 1652 * <pre> 1653 * Required. Context about the user, what they are looking at and what action 1654 * they took to trigger the predict request. Note that this user event detail 1655 * won't be ingested to userEvent logs. Thus, a separate userEvent write 1656 * request is required for event logging. 1657 * Don't set 1658 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 1659 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 1660 * fixed ID for different users. If you are trying to receive non-personalized 1661 * recommendations (not recommended; this can negatively impact model 1662 * performance), instead set 1663 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 1664 * random unique ID and leave 1665 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 1666 * </pre> 1667 * 1668 * <code> 1669 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 1670 * </code> 1671 */ setUserEvent(com.google.cloud.retail.v2.UserEvent.Builder builderForValue)1672 public Builder setUserEvent(com.google.cloud.retail.v2.UserEvent.Builder builderForValue) { 1673 if (userEventBuilder_ == null) { 1674 userEvent_ = builderForValue.build(); 1675 } else { 1676 userEventBuilder_.setMessage(builderForValue.build()); 1677 } 1678 bitField0_ |= 0x00000002; 1679 onChanged(); 1680 return this; 1681 } 1682 /** 1683 * 1684 * 1685 * <pre> 1686 * Required. Context about the user, what they are looking at and what action 1687 * they took to trigger the predict request. Note that this user event detail 1688 * won't be ingested to userEvent logs. Thus, a separate userEvent write 1689 * request is required for event logging. 1690 * Don't set 1691 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 1692 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 1693 * fixed ID for different users. If you are trying to receive non-personalized 1694 * recommendations (not recommended; this can negatively impact model 1695 * performance), instead set 1696 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 1697 * random unique ID and leave 1698 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 1699 * </pre> 1700 * 1701 * <code> 1702 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 1703 * </code> 1704 */ mergeUserEvent(com.google.cloud.retail.v2.UserEvent value)1705 public Builder mergeUserEvent(com.google.cloud.retail.v2.UserEvent value) { 1706 if (userEventBuilder_ == null) { 1707 if (((bitField0_ & 0x00000002) != 0) 1708 && userEvent_ != null 1709 && userEvent_ != com.google.cloud.retail.v2.UserEvent.getDefaultInstance()) { 1710 getUserEventBuilder().mergeFrom(value); 1711 } else { 1712 userEvent_ = value; 1713 } 1714 } else { 1715 userEventBuilder_.mergeFrom(value); 1716 } 1717 bitField0_ |= 0x00000002; 1718 onChanged(); 1719 return this; 1720 } 1721 /** 1722 * 1723 * 1724 * <pre> 1725 * Required. Context about the user, what they are looking at and what action 1726 * they took to trigger the predict request. Note that this user event detail 1727 * won't be ingested to userEvent logs. Thus, a separate userEvent write 1728 * request is required for event logging. 1729 * Don't set 1730 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 1731 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 1732 * fixed ID for different users. If you are trying to receive non-personalized 1733 * recommendations (not recommended; this can negatively impact model 1734 * performance), instead set 1735 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 1736 * random unique ID and leave 1737 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 1738 * </pre> 1739 * 1740 * <code> 1741 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 1742 * </code> 1743 */ clearUserEvent()1744 public Builder clearUserEvent() { 1745 bitField0_ = (bitField0_ & ~0x00000002); 1746 userEvent_ = null; 1747 if (userEventBuilder_ != null) { 1748 userEventBuilder_.dispose(); 1749 userEventBuilder_ = null; 1750 } 1751 onChanged(); 1752 return this; 1753 } 1754 /** 1755 * 1756 * 1757 * <pre> 1758 * Required. Context about the user, what they are looking at and what action 1759 * they took to trigger the predict request. Note that this user event detail 1760 * won't be ingested to userEvent logs. Thus, a separate userEvent write 1761 * request is required for event logging. 1762 * Don't set 1763 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 1764 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 1765 * fixed ID for different users. If you are trying to receive non-personalized 1766 * recommendations (not recommended; this can negatively impact model 1767 * performance), instead set 1768 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 1769 * random unique ID and leave 1770 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 1771 * </pre> 1772 * 1773 * <code> 1774 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 1775 * </code> 1776 */ getUserEventBuilder()1777 public com.google.cloud.retail.v2.UserEvent.Builder getUserEventBuilder() { 1778 bitField0_ |= 0x00000002; 1779 onChanged(); 1780 return getUserEventFieldBuilder().getBuilder(); 1781 } 1782 /** 1783 * 1784 * 1785 * <pre> 1786 * Required. Context about the user, what they are looking at and what action 1787 * they took to trigger the predict request. Note that this user event detail 1788 * won't be ingested to userEvent logs. Thus, a separate userEvent write 1789 * request is required for event logging. 1790 * Don't set 1791 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 1792 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 1793 * fixed ID for different users. If you are trying to receive non-personalized 1794 * recommendations (not recommended; this can negatively impact model 1795 * performance), instead set 1796 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 1797 * random unique ID and leave 1798 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 1799 * </pre> 1800 * 1801 * <code> 1802 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 1803 * </code> 1804 */ getUserEventOrBuilder()1805 public com.google.cloud.retail.v2.UserEventOrBuilder getUserEventOrBuilder() { 1806 if (userEventBuilder_ != null) { 1807 return userEventBuilder_.getMessageOrBuilder(); 1808 } else { 1809 return userEvent_ == null 1810 ? com.google.cloud.retail.v2.UserEvent.getDefaultInstance() 1811 : userEvent_; 1812 } 1813 } 1814 /** 1815 * 1816 * 1817 * <pre> 1818 * Required. Context about the user, what they are looking at and what action 1819 * they took to trigger the predict request. Note that this user event detail 1820 * won't be ingested to userEvent logs. Thus, a separate userEvent write 1821 * request is required for event logging. 1822 * Don't set 1823 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] or 1824 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] to the same 1825 * fixed ID for different users. If you are trying to receive non-personalized 1826 * recommendations (not recommended; this can negatively impact model 1827 * performance), instead set 1828 * [UserEvent.visitor_id][google.cloud.retail.v2.UserEvent.visitor_id] to a 1829 * random unique ID and leave 1830 * [UserInfo.user_id][google.cloud.retail.v2.UserInfo.user_id] unset. 1831 * </pre> 1832 * 1833 * <code> 1834 * .google.cloud.retail.v2.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; 1835 * </code> 1836 */ 1837 private com.google.protobuf.SingleFieldBuilderV3< 1838 com.google.cloud.retail.v2.UserEvent, 1839 com.google.cloud.retail.v2.UserEvent.Builder, 1840 com.google.cloud.retail.v2.UserEventOrBuilder> getUserEventFieldBuilder()1841 getUserEventFieldBuilder() { 1842 if (userEventBuilder_ == null) { 1843 userEventBuilder_ = 1844 new com.google.protobuf.SingleFieldBuilderV3< 1845 com.google.cloud.retail.v2.UserEvent, 1846 com.google.cloud.retail.v2.UserEvent.Builder, 1847 com.google.cloud.retail.v2.UserEventOrBuilder>( 1848 getUserEvent(), getParentForChildren(), isClean()); 1849 userEvent_ = null; 1850 } 1851 return userEventBuilder_; 1852 } 1853 1854 private int pageSize_; 1855 /** 1856 * 1857 * 1858 * <pre> 1859 * Maximum number of results to return. Set this property to the number of 1860 * prediction results needed. If zero, the service will choose a reasonable 1861 * default. The maximum allowed value is 100. Values above 100 will be coerced 1862 * to 100. 1863 * </pre> 1864 * 1865 * <code>int32 page_size = 3;</code> 1866 * 1867 * @return The pageSize. 1868 */ 1869 @java.lang.Override getPageSize()1870 public int getPageSize() { 1871 return pageSize_; 1872 } 1873 /** 1874 * 1875 * 1876 * <pre> 1877 * Maximum number of results to return. Set this property to the number of 1878 * prediction results needed. If zero, the service will choose a reasonable 1879 * default. The maximum allowed value is 100. Values above 100 will be coerced 1880 * to 100. 1881 * </pre> 1882 * 1883 * <code>int32 page_size = 3;</code> 1884 * 1885 * @param value The pageSize to set. 1886 * @return This builder for chaining. 1887 */ setPageSize(int value)1888 public Builder setPageSize(int value) { 1889 1890 pageSize_ = value; 1891 bitField0_ |= 0x00000004; 1892 onChanged(); 1893 return this; 1894 } 1895 /** 1896 * 1897 * 1898 * <pre> 1899 * Maximum number of results to return. Set this property to the number of 1900 * prediction results needed. If zero, the service will choose a reasonable 1901 * default. The maximum allowed value is 100. Values above 100 will be coerced 1902 * to 100. 1903 * </pre> 1904 * 1905 * <code>int32 page_size = 3;</code> 1906 * 1907 * @return This builder for chaining. 1908 */ clearPageSize()1909 public Builder clearPageSize() { 1910 bitField0_ = (bitField0_ & ~0x00000004); 1911 pageSize_ = 0; 1912 onChanged(); 1913 return this; 1914 } 1915 1916 private java.lang.Object pageToken_ = ""; 1917 /** 1918 * 1919 * 1920 * <pre> 1921 * This field is not used; leave it unset. 1922 * </pre> 1923 * 1924 * <code>string page_token = 4 [deprecated = true];</code> 1925 * 1926 * @deprecated google.cloud.retail.v2.PredictRequest.page_token is deprecated. See 1927 * google/cloud/retail/v2/prediction_service.proto;l=94 1928 * @return The pageToken. 1929 */ 1930 @java.lang.Deprecated getPageToken()1931 public java.lang.String getPageToken() { 1932 java.lang.Object ref = pageToken_; 1933 if (!(ref instanceof java.lang.String)) { 1934 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1935 java.lang.String s = bs.toStringUtf8(); 1936 pageToken_ = s; 1937 return s; 1938 } else { 1939 return (java.lang.String) ref; 1940 } 1941 } 1942 /** 1943 * 1944 * 1945 * <pre> 1946 * This field is not used; leave it unset. 1947 * </pre> 1948 * 1949 * <code>string page_token = 4 [deprecated = true];</code> 1950 * 1951 * @deprecated google.cloud.retail.v2.PredictRequest.page_token is deprecated. See 1952 * google/cloud/retail/v2/prediction_service.proto;l=94 1953 * @return The bytes for pageToken. 1954 */ 1955 @java.lang.Deprecated getPageTokenBytes()1956 public com.google.protobuf.ByteString getPageTokenBytes() { 1957 java.lang.Object ref = pageToken_; 1958 if (ref instanceof String) { 1959 com.google.protobuf.ByteString b = 1960 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1961 pageToken_ = b; 1962 return b; 1963 } else { 1964 return (com.google.protobuf.ByteString) ref; 1965 } 1966 } 1967 /** 1968 * 1969 * 1970 * <pre> 1971 * This field is not used; leave it unset. 1972 * </pre> 1973 * 1974 * <code>string page_token = 4 [deprecated = true];</code> 1975 * 1976 * @deprecated google.cloud.retail.v2.PredictRequest.page_token is deprecated. See 1977 * google/cloud/retail/v2/prediction_service.proto;l=94 1978 * @param value The pageToken to set. 1979 * @return This builder for chaining. 1980 */ 1981 @java.lang.Deprecated setPageToken(java.lang.String value)1982 public Builder setPageToken(java.lang.String value) { 1983 if (value == null) { 1984 throw new NullPointerException(); 1985 } 1986 pageToken_ = value; 1987 bitField0_ |= 0x00000008; 1988 onChanged(); 1989 return this; 1990 } 1991 /** 1992 * 1993 * 1994 * <pre> 1995 * This field is not used; leave it unset. 1996 * </pre> 1997 * 1998 * <code>string page_token = 4 [deprecated = true];</code> 1999 * 2000 * @deprecated google.cloud.retail.v2.PredictRequest.page_token is deprecated. See 2001 * google/cloud/retail/v2/prediction_service.proto;l=94 2002 * @return This builder for chaining. 2003 */ 2004 @java.lang.Deprecated clearPageToken()2005 public Builder clearPageToken() { 2006 pageToken_ = getDefaultInstance().getPageToken(); 2007 bitField0_ = (bitField0_ & ~0x00000008); 2008 onChanged(); 2009 return this; 2010 } 2011 /** 2012 * 2013 * 2014 * <pre> 2015 * This field is not used; leave it unset. 2016 * </pre> 2017 * 2018 * <code>string page_token = 4 [deprecated = true];</code> 2019 * 2020 * @deprecated google.cloud.retail.v2.PredictRequest.page_token is deprecated. See 2021 * google/cloud/retail/v2/prediction_service.proto;l=94 2022 * @param value The bytes for pageToken to set. 2023 * @return This builder for chaining. 2024 */ 2025 @java.lang.Deprecated setPageTokenBytes(com.google.protobuf.ByteString value)2026 public Builder setPageTokenBytes(com.google.protobuf.ByteString value) { 2027 if (value == null) { 2028 throw new NullPointerException(); 2029 } 2030 checkByteStringIsUtf8(value); 2031 pageToken_ = value; 2032 bitField0_ |= 0x00000008; 2033 onChanged(); 2034 return this; 2035 } 2036 2037 private java.lang.Object filter_ = ""; 2038 /** 2039 * 2040 * 2041 * <pre> 2042 * Filter for restricting prediction results with a length limit of 5,000 2043 * characters. Accepts values for tags and the `filterOutOfStockItems` flag. 2044 * * Tag expressions. Restricts predictions to products that match all of the 2045 * specified tags. Boolean operators `OR` and `NOT` are supported if the 2046 * expression is enclosed in parentheses, and must be separated from the 2047 * tag values by a space. `-"tagA"` is also supported and is equivalent to 2048 * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings 2049 * with a size limit of 1,000 characters. 2050 * Note: "Recently viewed" models don't support tag filtering at the 2051 * moment. 2052 * * filterOutOfStockItems. Restricts predictions to products that do not 2053 * have a 2054 * stockState value of OUT_OF_STOCK. 2055 * Examples: 2056 * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") 2057 * * filterOutOfStockItems tag=(-"promotional") 2058 * * filterOutOfStockItems 2059 * If your filter blocks all prediction results, the API will return *no* 2060 * results. If instead you want empty result sets to return generic 2061 * (unfiltered) popular products, set `strictFiltering` to False in 2062 * `PredictRequest.params`. Note that the API will never return items with 2063 * storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. 2064 * If `filterSyntaxV2` is set to true under the `params` field, then 2065 * attribute-based expressions are expected instead of the above described 2066 * tag-based syntax. Examples: 2067 * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) 2068 * * (availability: ANY("IN_STOCK")) AND 2069 * (colors: ANY("Red") OR categories: ANY("Phones")) 2070 * For more information, see 2071 * [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). 2072 * </pre> 2073 * 2074 * <code>string filter = 5;</code> 2075 * 2076 * @return The filter. 2077 */ getFilter()2078 public java.lang.String getFilter() { 2079 java.lang.Object ref = filter_; 2080 if (!(ref instanceof java.lang.String)) { 2081 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 2082 java.lang.String s = bs.toStringUtf8(); 2083 filter_ = s; 2084 return s; 2085 } else { 2086 return (java.lang.String) ref; 2087 } 2088 } 2089 /** 2090 * 2091 * 2092 * <pre> 2093 * Filter for restricting prediction results with a length limit of 5,000 2094 * characters. Accepts values for tags and the `filterOutOfStockItems` flag. 2095 * * Tag expressions. Restricts predictions to products that match all of the 2096 * specified tags. Boolean operators `OR` and `NOT` are supported if the 2097 * expression is enclosed in parentheses, and must be separated from the 2098 * tag values by a space. `-"tagA"` is also supported and is equivalent to 2099 * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings 2100 * with a size limit of 1,000 characters. 2101 * Note: "Recently viewed" models don't support tag filtering at the 2102 * moment. 2103 * * filterOutOfStockItems. Restricts predictions to products that do not 2104 * have a 2105 * stockState value of OUT_OF_STOCK. 2106 * Examples: 2107 * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") 2108 * * filterOutOfStockItems tag=(-"promotional") 2109 * * filterOutOfStockItems 2110 * If your filter blocks all prediction results, the API will return *no* 2111 * results. If instead you want empty result sets to return generic 2112 * (unfiltered) popular products, set `strictFiltering` to False in 2113 * `PredictRequest.params`. Note that the API will never return items with 2114 * storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. 2115 * If `filterSyntaxV2` is set to true under the `params` field, then 2116 * attribute-based expressions are expected instead of the above described 2117 * tag-based syntax. Examples: 2118 * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) 2119 * * (availability: ANY("IN_STOCK")) AND 2120 * (colors: ANY("Red") OR categories: ANY("Phones")) 2121 * For more information, see 2122 * [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). 2123 * </pre> 2124 * 2125 * <code>string filter = 5;</code> 2126 * 2127 * @return The bytes for filter. 2128 */ getFilterBytes()2129 public com.google.protobuf.ByteString getFilterBytes() { 2130 java.lang.Object ref = filter_; 2131 if (ref instanceof String) { 2132 com.google.protobuf.ByteString b = 2133 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 2134 filter_ = b; 2135 return b; 2136 } else { 2137 return (com.google.protobuf.ByteString) ref; 2138 } 2139 } 2140 /** 2141 * 2142 * 2143 * <pre> 2144 * Filter for restricting prediction results with a length limit of 5,000 2145 * characters. Accepts values for tags and the `filterOutOfStockItems` flag. 2146 * * Tag expressions. Restricts predictions to products that match all of the 2147 * specified tags. Boolean operators `OR` and `NOT` are supported if the 2148 * expression is enclosed in parentheses, and must be separated from the 2149 * tag values by a space. `-"tagA"` is also supported and is equivalent to 2150 * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings 2151 * with a size limit of 1,000 characters. 2152 * Note: "Recently viewed" models don't support tag filtering at the 2153 * moment. 2154 * * filterOutOfStockItems. Restricts predictions to products that do not 2155 * have a 2156 * stockState value of OUT_OF_STOCK. 2157 * Examples: 2158 * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") 2159 * * filterOutOfStockItems tag=(-"promotional") 2160 * * filterOutOfStockItems 2161 * If your filter blocks all prediction results, the API will return *no* 2162 * results. If instead you want empty result sets to return generic 2163 * (unfiltered) popular products, set `strictFiltering` to False in 2164 * `PredictRequest.params`. Note that the API will never return items with 2165 * storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. 2166 * If `filterSyntaxV2` is set to true under the `params` field, then 2167 * attribute-based expressions are expected instead of the above described 2168 * tag-based syntax. Examples: 2169 * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) 2170 * * (availability: ANY("IN_STOCK")) AND 2171 * (colors: ANY("Red") OR categories: ANY("Phones")) 2172 * For more information, see 2173 * [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). 2174 * </pre> 2175 * 2176 * <code>string filter = 5;</code> 2177 * 2178 * @param value The filter to set. 2179 * @return This builder for chaining. 2180 */ setFilter(java.lang.String value)2181 public Builder setFilter(java.lang.String value) { 2182 if (value == null) { 2183 throw new NullPointerException(); 2184 } 2185 filter_ = value; 2186 bitField0_ |= 0x00000010; 2187 onChanged(); 2188 return this; 2189 } 2190 /** 2191 * 2192 * 2193 * <pre> 2194 * Filter for restricting prediction results with a length limit of 5,000 2195 * characters. Accepts values for tags and the `filterOutOfStockItems` flag. 2196 * * Tag expressions. Restricts predictions to products that match all of the 2197 * specified tags. Boolean operators `OR` and `NOT` are supported if the 2198 * expression is enclosed in parentheses, and must be separated from the 2199 * tag values by a space. `-"tagA"` is also supported and is equivalent to 2200 * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings 2201 * with a size limit of 1,000 characters. 2202 * Note: "Recently viewed" models don't support tag filtering at the 2203 * moment. 2204 * * filterOutOfStockItems. Restricts predictions to products that do not 2205 * have a 2206 * stockState value of OUT_OF_STOCK. 2207 * Examples: 2208 * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") 2209 * * filterOutOfStockItems tag=(-"promotional") 2210 * * filterOutOfStockItems 2211 * If your filter blocks all prediction results, the API will return *no* 2212 * results. If instead you want empty result sets to return generic 2213 * (unfiltered) popular products, set `strictFiltering` to False in 2214 * `PredictRequest.params`. Note that the API will never return items with 2215 * storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. 2216 * If `filterSyntaxV2` is set to true under the `params` field, then 2217 * attribute-based expressions are expected instead of the above described 2218 * tag-based syntax. Examples: 2219 * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) 2220 * * (availability: ANY("IN_STOCK")) AND 2221 * (colors: ANY("Red") OR categories: ANY("Phones")) 2222 * For more information, see 2223 * [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). 2224 * </pre> 2225 * 2226 * <code>string filter = 5;</code> 2227 * 2228 * @return This builder for chaining. 2229 */ clearFilter()2230 public Builder clearFilter() { 2231 filter_ = getDefaultInstance().getFilter(); 2232 bitField0_ = (bitField0_ & ~0x00000010); 2233 onChanged(); 2234 return this; 2235 } 2236 /** 2237 * 2238 * 2239 * <pre> 2240 * Filter for restricting prediction results with a length limit of 5,000 2241 * characters. Accepts values for tags and the `filterOutOfStockItems` flag. 2242 * * Tag expressions. Restricts predictions to products that match all of the 2243 * specified tags. Boolean operators `OR` and `NOT` are supported if the 2244 * expression is enclosed in parentheses, and must be separated from the 2245 * tag values by a space. `-"tagA"` is also supported and is equivalent to 2246 * `NOT "tagA"`. Tag values must be double quoted UTF-8 encoded strings 2247 * with a size limit of 1,000 characters. 2248 * Note: "Recently viewed" models don't support tag filtering at the 2249 * moment. 2250 * * filterOutOfStockItems. Restricts predictions to products that do not 2251 * have a 2252 * stockState value of OUT_OF_STOCK. 2253 * Examples: 2254 * * tag=("Red" OR "Blue") tag="New-Arrival" tag=(NOT "promotional") 2255 * * filterOutOfStockItems tag=(-"promotional") 2256 * * filterOutOfStockItems 2257 * If your filter blocks all prediction results, the API will return *no* 2258 * results. If instead you want empty result sets to return generic 2259 * (unfiltered) popular products, set `strictFiltering` to False in 2260 * `PredictRequest.params`. Note that the API will never return items with 2261 * storageStatus of "EXPIRED" or "DELETED" regardless of filter choices. 2262 * If `filterSyntaxV2` is set to true under the `params` field, then 2263 * attribute-based expressions are expected instead of the above described 2264 * tag-based syntax. Examples: 2265 * * (colors: ANY("Red", "Blue")) AND NOT (categories: ANY("Phones")) 2266 * * (availability: ANY("IN_STOCK")) AND 2267 * (colors: ANY("Red") OR categories: ANY("Phones")) 2268 * For more information, see 2269 * [Filter recommendations](https://cloud.google.com/retail/docs/filter-recs). 2270 * </pre> 2271 * 2272 * <code>string filter = 5;</code> 2273 * 2274 * @param value The bytes for filter to set. 2275 * @return This builder for chaining. 2276 */ setFilterBytes(com.google.protobuf.ByteString value)2277 public Builder setFilterBytes(com.google.protobuf.ByteString value) { 2278 if (value == null) { 2279 throw new NullPointerException(); 2280 } 2281 checkByteStringIsUtf8(value); 2282 filter_ = value; 2283 bitField0_ |= 0x00000010; 2284 onChanged(); 2285 return this; 2286 } 2287 2288 private boolean validateOnly_; 2289 /** 2290 * 2291 * 2292 * <pre> 2293 * Use validate only mode for this prediction query. If set to true, a 2294 * dummy model will be used that returns arbitrary products. 2295 * Note that the validate only mode should only be used for testing the API, 2296 * or if the model is not ready. 2297 * </pre> 2298 * 2299 * <code>bool validate_only = 6;</code> 2300 * 2301 * @return The validateOnly. 2302 */ 2303 @java.lang.Override getValidateOnly()2304 public boolean getValidateOnly() { 2305 return validateOnly_; 2306 } 2307 /** 2308 * 2309 * 2310 * <pre> 2311 * Use validate only mode for this prediction query. If set to true, a 2312 * dummy model will be used that returns arbitrary products. 2313 * Note that the validate only mode should only be used for testing the API, 2314 * or if the model is not ready. 2315 * </pre> 2316 * 2317 * <code>bool validate_only = 6;</code> 2318 * 2319 * @param value The validateOnly to set. 2320 * @return This builder for chaining. 2321 */ setValidateOnly(boolean value)2322 public Builder setValidateOnly(boolean value) { 2323 2324 validateOnly_ = value; 2325 bitField0_ |= 0x00000020; 2326 onChanged(); 2327 return this; 2328 } 2329 /** 2330 * 2331 * 2332 * <pre> 2333 * Use validate only mode for this prediction query. If set to true, a 2334 * dummy model will be used that returns arbitrary products. 2335 * Note that the validate only mode should only be used for testing the API, 2336 * or if the model is not ready. 2337 * </pre> 2338 * 2339 * <code>bool validate_only = 6;</code> 2340 * 2341 * @return This builder for chaining. 2342 */ clearValidateOnly()2343 public Builder clearValidateOnly() { 2344 bitField0_ = (bitField0_ & ~0x00000020); 2345 validateOnly_ = false; 2346 onChanged(); 2347 return this; 2348 } 2349 2350 private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> params_; 2351 2352 private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> internalGetParams()2353 internalGetParams() { 2354 if (params_ == null) { 2355 return com.google.protobuf.MapField.emptyMapField(ParamsDefaultEntryHolder.defaultEntry); 2356 } 2357 return params_; 2358 } 2359 2360 private com.google.protobuf.MapField<java.lang.String, com.google.protobuf.Value> internalGetMutableParams()2361 internalGetMutableParams() { 2362 if (params_ == null) { 2363 params_ = com.google.protobuf.MapField.newMapField(ParamsDefaultEntryHolder.defaultEntry); 2364 } 2365 if (!params_.isMutable()) { 2366 params_ = params_.copy(); 2367 } 2368 bitField0_ |= 0x00000040; 2369 onChanged(); 2370 return params_; 2371 } 2372 getParamsCount()2373 public int getParamsCount() { 2374 return internalGetParams().getMap().size(); 2375 } 2376 /** 2377 * 2378 * 2379 * <pre> 2380 * Additional domain specific parameters for the predictions. 2381 * Allowed values: 2382 * * `returnProduct`: Boolean. If set to true, the associated product 2383 * object will be returned in the `results.metadata` field in the 2384 * prediction response. 2385 * * `returnScore`: Boolean. If set to true, the prediction 'score' 2386 * corresponding to each returned product will be set in the 2387 * `results.metadata` field in the prediction response. The given 2388 * 'score' indicates the probability of a product being clicked/purchased 2389 * given the user's context and history. 2390 * * `strictFiltering`: Boolean. True by default. If set to false, the service 2391 * will return generic (unfiltered) popular products instead of empty if 2392 * your filter blocks all prediction results. 2393 * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then 2394 * it needs to be one of {'no-price-reranking', 'low-price-reranking', 2395 * 'medium-price-reranking', 'high-price-reranking'}. This gives 2396 * request-level control and adjusts prediction results based on product 2397 * price. 2398 * * `diversityLevel`: String. Default empty. If set to be non-empty, then 2399 * it needs to be one of {'no-diversity', 'low-diversity', 2400 * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives 2401 * request-level control and adjusts prediction results based on product 2402 * category. 2403 * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` 2404 * field is interpreteted according to the new, attribute-based syntax. 2405 * </pre> 2406 * 2407 * <code>map<string, .google.protobuf.Value> params = 7;</code> 2408 */ 2409 @java.lang.Override containsParams(java.lang.String key)2410 public boolean containsParams(java.lang.String key) { 2411 if (key == null) { 2412 throw new NullPointerException("map key"); 2413 } 2414 return internalGetParams().getMap().containsKey(key); 2415 } 2416 /** Use {@link #getParamsMap()} instead. */ 2417 @java.lang.Override 2418 @java.lang.Deprecated getParams()2419 public java.util.Map<java.lang.String, com.google.protobuf.Value> getParams() { 2420 return getParamsMap(); 2421 } 2422 /** 2423 * 2424 * 2425 * <pre> 2426 * Additional domain specific parameters for the predictions. 2427 * Allowed values: 2428 * * `returnProduct`: Boolean. If set to true, the associated product 2429 * object will be returned in the `results.metadata` field in the 2430 * prediction response. 2431 * * `returnScore`: Boolean. If set to true, the prediction 'score' 2432 * corresponding to each returned product will be set in the 2433 * `results.metadata` field in the prediction response. The given 2434 * 'score' indicates the probability of a product being clicked/purchased 2435 * given the user's context and history. 2436 * * `strictFiltering`: Boolean. True by default. If set to false, the service 2437 * will return generic (unfiltered) popular products instead of empty if 2438 * your filter blocks all prediction results. 2439 * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then 2440 * it needs to be one of {'no-price-reranking', 'low-price-reranking', 2441 * 'medium-price-reranking', 'high-price-reranking'}. This gives 2442 * request-level control and adjusts prediction results based on product 2443 * price. 2444 * * `diversityLevel`: String. Default empty. If set to be non-empty, then 2445 * it needs to be one of {'no-diversity', 'low-diversity', 2446 * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives 2447 * request-level control and adjusts prediction results based on product 2448 * category. 2449 * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` 2450 * field is interpreteted according to the new, attribute-based syntax. 2451 * </pre> 2452 * 2453 * <code>map<string, .google.protobuf.Value> params = 7;</code> 2454 */ 2455 @java.lang.Override getParamsMap()2456 public java.util.Map<java.lang.String, com.google.protobuf.Value> getParamsMap() { 2457 return internalGetParams().getMap(); 2458 } 2459 /** 2460 * 2461 * 2462 * <pre> 2463 * Additional domain specific parameters for the predictions. 2464 * Allowed values: 2465 * * `returnProduct`: Boolean. If set to true, the associated product 2466 * object will be returned in the `results.metadata` field in the 2467 * prediction response. 2468 * * `returnScore`: Boolean. If set to true, the prediction 'score' 2469 * corresponding to each returned product will be set in the 2470 * `results.metadata` field in the prediction response. The given 2471 * 'score' indicates the probability of a product being clicked/purchased 2472 * given the user's context and history. 2473 * * `strictFiltering`: Boolean. True by default. If set to false, the service 2474 * will return generic (unfiltered) popular products instead of empty if 2475 * your filter blocks all prediction results. 2476 * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then 2477 * it needs to be one of {'no-price-reranking', 'low-price-reranking', 2478 * 'medium-price-reranking', 'high-price-reranking'}. This gives 2479 * request-level control and adjusts prediction results based on product 2480 * price. 2481 * * `diversityLevel`: String. Default empty. If set to be non-empty, then 2482 * it needs to be one of {'no-diversity', 'low-diversity', 2483 * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives 2484 * request-level control and adjusts prediction results based on product 2485 * category. 2486 * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` 2487 * field is interpreteted according to the new, attribute-based syntax. 2488 * </pre> 2489 * 2490 * <code>map<string, .google.protobuf.Value> params = 7;</code> 2491 */ 2492 @java.lang.Override getParamsOrDefault( java.lang.String key, com.google.protobuf.Value defaultValue)2493 public /* nullable */ com.google.protobuf.Value getParamsOrDefault( 2494 java.lang.String key, 2495 /* nullable */ 2496 com.google.protobuf.Value defaultValue) { 2497 if (key == null) { 2498 throw new NullPointerException("map key"); 2499 } 2500 java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetParams().getMap(); 2501 return map.containsKey(key) ? map.get(key) : defaultValue; 2502 } 2503 /** 2504 * 2505 * 2506 * <pre> 2507 * Additional domain specific parameters for the predictions. 2508 * Allowed values: 2509 * * `returnProduct`: Boolean. If set to true, the associated product 2510 * object will be returned in the `results.metadata` field in the 2511 * prediction response. 2512 * * `returnScore`: Boolean. If set to true, the prediction 'score' 2513 * corresponding to each returned product will be set in the 2514 * `results.metadata` field in the prediction response. The given 2515 * 'score' indicates the probability of a product being clicked/purchased 2516 * given the user's context and history. 2517 * * `strictFiltering`: Boolean. True by default. If set to false, the service 2518 * will return generic (unfiltered) popular products instead of empty if 2519 * your filter blocks all prediction results. 2520 * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then 2521 * it needs to be one of {'no-price-reranking', 'low-price-reranking', 2522 * 'medium-price-reranking', 'high-price-reranking'}. This gives 2523 * request-level control and adjusts prediction results based on product 2524 * price. 2525 * * `diversityLevel`: String. Default empty. If set to be non-empty, then 2526 * it needs to be one of {'no-diversity', 'low-diversity', 2527 * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives 2528 * request-level control and adjusts prediction results based on product 2529 * category. 2530 * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` 2531 * field is interpreteted according to the new, attribute-based syntax. 2532 * </pre> 2533 * 2534 * <code>map<string, .google.protobuf.Value> params = 7;</code> 2535 */ 2536 @java.lang.Override getParamsOrThrow(java.lang.String key)2537 public com.google.protobuf.Value getParamsOrThrow(java.lang.String key) { 2538 if (key == null) { 2539 throw new NullPointerException("map key"); 2540 } 2541 java.util.Map<java.lang.String, com.google.protobuf.Value> map = internalGetParams().getMap(); 2542 if (!map.containsKey(key)) { 2543 throw new java.lang.IllegalArgumentException(); 2544 } 2545 return map.get(key); 2546 } 2547 clearParams()2548 public Builder clearParams() { 2549 bitField0_ = (bitField0_ & ~0x00000040); 2550 internalGetMutableParams().getMutableMap().clear(); 2551 return this; 2552 } 2553 /** 2554 * 2555 * 2556 * <pre> 2557 * Additional domain specific parameters for the predictions. 2558 * Allowed values: 2559 * * `returnProduct`: Boolean. If set to true, the associated product 2560 * object will be returned in the `results.metadata` field in the 2561 * prediction response. 2562 * * `returnScore`: Boolean. If set to true, the prediction 'score' 2563 * corresponding to each returned product will be set in the 2564 * `results.metadata` field in the prediction response. The given 2565 * 'score' indicates the probability of a product being clicked/purchased 2566 * given the user's context and history. 2567 * * `strictFiltering`: Boolean. True by default. If set to false, the service 2568 * will return generic (unfiltered) popular products instead of empty if 2569 * your filter blocks all prediction results. 2570 * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then 2571 * it needs to be one of {'no-price-reranking', 'low-price-reranking', 2572 * 'medium-price-reranking', 'high-price-reranking'}. This gives 2573 * request-level control and adjusts prediction results based on product 2574 * price. 2575 * * `diversityLevel`: String. Default empty. If set to be non-empty, then 2576 * it needs to be one of {'no-diversity', 'low-diversity', 2577 * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives 2578 * request-level control and adjusts prediction results based on product 2579 * category. 2580 * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` 2581 * field is interpreteted according to the new, attribute-based syntax. 2582 * </pre> 2583 * 2584 * <code>map<string, .google.protobuf.Value> params = 7;</code> 2585 */ removeParams(java.lang.String key)2586 public Builder removeParams(java.lang.String key) { 2587 if (key == null) { 2588 throw new NullPointerException("map key"); 2589 } 2590 internalGetMutableParams().getMutableMap().remove(key); 2591 return this; 2592 } 2593 /** Use alternate mutation accessors instead. */ 2594 @java.lang.Deprecated getMutableParams()2595 public java.util.Map<java.lang.String, com.google.protobuf.Value> getMutableParams() { 2596 bitField0_ |= 0x00000040; 2597 return internalGetMutableParams().getMutableMap(); 2598 } 2599 /** 2600 * 2601 * 2602 * <pre> 2603 * Additional domain specific parameters for the predictions. 2604 * Allowed values: 2605 * * `returnProduct`: Boolean. If set to true, the associated product 2606 * object will be returned in the `results.metadata` field in the 2607 * prediction response. 2608 * * `returnScore`: Boolean. If set to true, the prediction 'score' 2609 * corresponding to each returned product will be set in the 2610 * `results.metadata` field in the prediction response. The given 2611 * 'score' indicates the probability of a product being clicked/purchased 2612 * given the user's context and history. 2613 * * `strictFiltering`: Boolean. True by default. If set to false, the service 2614 * will return generic (unfiltered) popular products instead of empty if 2615 * your filter blocks all prediction results. 2616 * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then 2617 * it needs to be one of {'no-price-reranking', 'low-price-reranking', 2618 * 'medium-price-reranking', 'high-price-reranking'}. This gives 2619 * request-level control and adjusts prediction results based on product 2620 * price. 2621 * * `diversityLevel`: String. Default empty. If set to be non-empty, then 2622 * it needs to be one of {'no-diversity', 'low-diversity', 2623 * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives 2624 * request-level control and adjusts prediction results based on product 2625 * category. 2626 * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` 2627 * field is interpreteted according to the new, attribute-based syntax. 2628 * </pre> 2629 * 2630 * <code>map<string, .google.protobuf.Value> params = 7;</code> 2631 */ putParams(java.lang.String key, com.google.protobuf.Value value)2632 public Builder putParams(java.lang.String key, com.google.protobuf.Value value) { 2633 if (key == null) { 2634 throw new NullPointerException("map key"); 2635 } 2636 if (value == null) { 2637 throw new NullPointerException("map value"); 2638 } 2639 internalGetMutableParams().getMutableMap().put(key, value); 2640 bitField0_ |= 0x00000040; 2641 return this; 2642 } 2643 /** 2644 * 2645 * 2646 * <pre> 2647 * Additional domain specific parameters for the predictions. 2648 * Allowed values: 2649 * * `returnProduct`: Boolean. If set to true, the associated product 2650 * object will be returned in the `results.metadata` field in the 2651 * prediction response. 2652 * * `returnScore`: Boolean. If set to true, the prediction 'score' 2653 * corresponding to each returned product will be set in the 2654 * `results.metadata` field in the prediction response. The given 2655 * 'score' indicates the probability of a product being clicked/purchased 2656 * given the user's context and history. 2657 * * `strictFiltering`: Boolean. True by default. If set to false, the service 2658 * will return generic (unfiltered) popular products instead of empty if 2659 * your filter blocks all prediction results. 2660 * * `priceRerankLevel`: String. Default empty. If set to be non-empty, then 2661 * it needs to be one of {'no-price-reranking', 'low-price-reranking', 2662 * 'medium-price-reranking', 'high-price-reranking'}. This gives 2663 * request-level control and adjusts prediction results based on product 2664 * price. 2665 * * `diversityLevel`: String. Default empty. If set to be non-empty, then 2666 * it needs to be one of {'no-diversity', 'low-diversity', 2667 * 'medium-diversity', 'high-diversity', 'auto-diversity'}. This gives 2668 * request-level control and adjusts prediction results based on product 2669 * category. 2670 * * `filterSyntaxV2`: Boolean. False by default. If set to true, the `filter` 2671 * field is interpreteted according to the new, attribute-based syntax. 2672 * </pre> 2673 * 2674 * <code>map<string, .google.protobuf.Value> params = 7;</code> 2675 */ putAllParams(java.util.Map<java.lang.String, com.google.protobuf.Value> values)2676 public Builder putAllParams(java.util.Map<java.lang.String, com.google.protobuf.Value> values) { 2677 internalGetMutableParams().getMutableMap().putAll(values); 2678 bitField0_ |= 0x00000040; 2679 return this; 2680 } 2681 2682 private com.google.protobuf.MapField<java.lang.String, java.lang.String> labels_; 2683 internalGetLabels()2684 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetLabels() { 2685 if (labels_ == null) { 2686 return com.google.protobuf.MapField.emptyMapField(LabelsDefaultEntryHolder.defaultEntry); 2687 } 2688 return labels_; 2689 } 2690 2691 private com.google.protobuf.MapField<java.lang.String, java.lang.String> internalGetMutableLabels()2692 internalGetMutableLabels() { 2693 if (labels_ == null) { 2694 labels_ = com.google.protobuf.MapField.newMapField(LabelsDefaultEntryHolder.defaultEntry); 2695 } 2696 if (!labels_.isMutable()) { 2697 labels_ = labels_.copy(); 2698 } 2699 bitField0_ |= 0x00000080; 2700 onChanged(); 2701 return labels_; 2702 } 2703 getLabelsCount()2704 public int getLabelsCount() { 2705 return internalGetLabels().getMap().size(); 2706 } 2707 /** 2708 * 2709 * 2710 * <pre> 2711 * The labels applied to a resource must meet the following requirements: 2712 * * Each resource can have multiple labels, up to a maximum of 64. 2713 * * Each label must be a key-value pair. 2714 * * Keys have a minimum length of 1 character and a maximum length of 63 2715 * characters and cannot be empty. Values can be empty and have a maximum 2716 * length of 63 characters. 2717 * * Keys and values can contain only lowercase letters, numeric characters, 2718 * underscores, and dashes. All characters must use UTF-8 encoding, and 2719 * international characters are allowed. 2720 * * The key portion of a label must be unique. However, you can use the same 2721 * key with multiple resources. 2722 * * Keys must start with a lowercase letter or international character. 2723 * See [Google Cloud 2724 * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) 2725 * for more details. 2726 * </pre> 2727 * 2728 * <code>map<string, string> labels = 8;</code> 2729 */ 2730 @java.lang.Override containsLabels(java.lang.String key)2731 public boolean containsLabels(java.lang.String key) { 2732 if (key == null) { 2733 throw new NullPointerException("map key"); 2734 } 2735 return internalGetLabels().getMap().containsKey(key); 2736 } 2737 /** Use {@link #getLabelsMap()} instead. */ 2738 @java.lang.Override 2739 @java.lang.Deprecated getLabels()2740 public java.util.Map<java.lang.String, java.lang.String> getLabels() { 2741 return getLabelsMap(); 2742 } 2743 /** 2744 * 2745 * 2746 * <pre> 2747 * The labels applied to a resource must meet the following requirements: 2748 * * Each resource can have multiple labels, up to a maximum of 64. 2749 * * Each label must be a key-value pair. 2750 * * Keys have a minimum length of 1 character and a maximum length of 63 2751 * characters and cannot be empty. Values can be empty and have a maximum 2752 * length of 63 characters. 2753 * * Keys and values can contain only lowercase letters, numeric characters, 2754 * underscores, and dashes. All characters must use UTF-8 encoding, and 2755 * international characters are allowed. 2756 * * The key portion of a label must be unique. However, you can use the same 2757 * key with multiple resources. 2758 * * Keys must start with a lowercase letter or international character. 2759 * See [Google Cloud 2760 * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) 2761 * for more details. 2762 * </pre> 2763 * 2764 * <code>map<string, string> labels = 8;</code> 2765 */ 2766 @java.lang.Override getLabelsMap()2767 public java.util.Map<java.lang.String, java.lang.String> getLabelsMap() { 2768 return internalGetLabels().getMap(); 2769 } 2770 /** 2771 * 2772 * 2773 * <pre> 2774 * The labels applied to a resource must meet the following requirements: 2775 * * Each resource can have multiple labels, up to a maximum of 64. 2776 * * Each label must be a key-value pair. 2777 * * Keys have a minimum length of 1 character and a maximum length of 63 2778 * characters and cannot be empty. Values can be empty and have a maximum 2779 * length of 63 characters. 2780 * * Keys and values can contain only lowercase letters, numeric characters, 2781 * underscores, and dashes. All characters must use UTF-8 encoding, and 2782 * international characters are allowed. 2783 * * The key portion of a label must be unique. However, you can use the same 2784 * key with multiple resources. 2785 * * Keys must start with a lowercase letter or international character. 2786 * See [Google Cloud 2787 * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) 2788 * for more details. 2789 * </pre> 2790 * 2791 * <code>map<string, string> labels = 8;</code> 2792 */ 2793 @java.lang.Override getLabelsOrDefault( java.lang.String key, java.lang.String defaultValue)2794 public /* nullable */ java.lang.String getLabelsOrDefault( 2795 java.lang.String key, 2796 /* nullable */ 2797 java.lang.String defaultValue) { 2798 if (key == null) { 2799 throw new NullPointerException("map key"); 2800 } 2801 java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap(); 2802 return map.containsKey(key) ? map.get(key) : defaultValue; 2803 } 2804 /** 2805 * 2806 * 2807 * <pre> 2808 * The labels applied to a resource must meet the following requirements: 2809 * * Each resource can have multiple labels, up to a maximum of 64. 2810 * * Each label must be a key-value pair. 2811 * * Keys have a minimum length of 1 character and a maximum length of 63 2812 * characters and cannot be empty. Values can be empty and have a maximum 2813 * length of 63 characters. 2814 * * Keys and values can contain only lowercase letters, numeric characters, 2815 * underscores, and dashes. All characters must use UTF-8 encoding, and 2816 * international characters are allowed. 2817 * * The key portion of a label must be unique. However, you can use the same 2818 * key with multiple resources. 2819 * * Keys must start with a lowercase letter or international character. 2820 * See [Google Cloud 2821 * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) 2822 * for more details. 2823 * </pre> 2824 * 2825 * <code>map<string, string> labels = 8;</code> 2826 */ 2827 @java.lang.Override getLabelsOrThrow(java.lang.String key)2828 public java.lang.String getLabelsOrThrow(java.lang.String key) { 2829 if (key == null) { 2830 throw new NullPointerException("map key"); 2831 } 2832 java.util.Map<java.lang.String, java.lang.String> map = internalGetLabels().getMap(); 2833 if (!map.containsKey(key)) { 2834 throw new java.lang.IllegalArgumentException(); 2835 } 2836 return map.get(key); 2837 } 2838 clearLabels()2839 public Builder clearLabels() { 2840 bitField0_ = (bitField0_ & ~0x00000080); 2841 internalGetMutableLabels().getMutableMap().clear(); 2842 return this; 2843 } 2844 /** 2845 * 2846 * 2847 * <pre> 2848 * The labels applied to a resource must meet the following requirements: 2849 * * Each resource can have multiple labels, up to a maximum of 64. 2850 * * Each label must be a key-value pair. 2851 * * Keys have a minimum length of 1 character and a maximum length of 63 2852 * characters and cannot be empty. Values can be empty and have a maximum 2853 * length of 63 characters. 2854 * * Keys and values can contain only lowercase letters, numeric characters, 2855 * underscores, and dashes. All characters must use UTF-8 encoding, and 2856 * international characters are allowed. 2857 * * The key portion of a label must be unique. However, you can use the same 2858 * key with multiple resources. 2859 * * Keys must start with a lowercase letter or international character. 2860 * See [Google Cloud 2861 * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) 2862 * for more details. 2863 * </pre> 2864 * 2865 * <code>map<string, string> labels = 8;</code> 2866 */ removeLabels(java.lang.String key)2867 public Builder removeLabels(java.lang.String key) { 2868 if (key == null) { 2869 throw new NullPointerException("map key"); 2870 } 2871 internalGetMutableLabels().getMutableMap().remove(key); 2872 return this; 2873 } 2874 /** Use alternate mutation accessors instead. */ 2875 @java.lang.Deprecated getMutableLabels()2876 public java.util.Map<java.lang.String, java.lang.String> getMutableLabels() { 2877 bitField0_ |= 0x00000080; 2878 return internalGetMutableLabels().getMutableMap(); 2879 } 2880 /** 2881 * 2882 * 2883 * <pre> 2884 * The labels applied to a resource must meet the following requirements: 2885 * * Each resource can have multiple labels, up to a maximum of 64. 2886 * * Each label must be a key-value pair. 2887 * * Keys have a minimum length of 1 character and a maximum length of 63 2888 * characters and cannot be empty. Values can be empty and have a maximum 2889 * length of 63 characters. 2890 * * Keys and values can contain only lowercase letters, numeric characters, 2891 * underscores, and dashes. All characters must use UTF-8 encoding, and 2892 * international characters are allowed. 2893 * * The key portion of a label must be unique. However, you can use the same 2894 * key with multiple resources. 2895 * * Keys must start with a lowercase letter or international character. 2896 * See [Google Cloud 2897 * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) 2898 * for more details. 2899 * </pre> 2900 * 2901 * <code>map<string, string> labels = 8;</code> 2902 */ putLabels(java.lang.String key, java.lang.String value)2903 public Builder putLabels(java.lang.String key, java.lang.String value) { 2904 if (key == null) { 2905 throw new NullPointerException("map key"); 2906 } 2907 if (value == null) { 2908 throw new NullPointerException("map value"); 2909 } 2910 internalGetMutableLabels().getMutableMap().put(key, value); 2911 bitField0_ |= 0x00000080; 2912 return this; 2913 } 2914 /** 2915 * 2916 * 2917 * <pre> 2918 * The labels applied to a resource must meet the following requirements: 2919 * * Each resource can have multiple labels, up to a maximum of 64. 2920 * * Each label must be a key-value pair. 2921 * * Keys have a minimum length of 1 character and a maximum length of 63 2922 * characters and cannot be empty. Values can be empty and have a maximum 2923 * length of 63 characters. 2924 * * Keys and values can contain only lowercase letters, numeric characters, 2925 * underscores, and dashes. All characters must use UTF-8 encoding, and 2926 * international characters are allowed. 2927 * * The key portion of a label must be unique. However, you can use the same 2928 * key with multiple resources. 2929 * * Keys must start with a lowercase letter or international character. 2930 * See [Google Cloud 2931 * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) 2932 * for more details. 2933 * </pre> 2934 * 2935 * <code>map<string, string> labels = 8;</code> 2936 */ putAllLabels(java.util.Map<java.lang.String, java.lang.String> values)2937 public Builder putAllLabels(java.util.Map<java.lang.String, java.lang.String> values) { 2938 internalGetMutableLabels().getMutableMap().putAll(values); 2939 bitField0_ |= 0x00000080; 2940 return this; 2941 } 2942 2943 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)2944 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 2945 return super.setUnknownFields(unknownFields); 2946 } 2947 2948 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)2949 public final Builder mergeUnknownFields( 2950 final com.google.protobuf.UnknownFieldSet unknownFields) { 2951 return super.mergeUnknownFields(unknownFields); 2952 } 2953 2954 // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.PredictRequest) 2955 } 2956 2957 // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.PredictRequest) 2958 private static final com.google.cloud.retail.v2.PredictRequest DEFAULT_INSTANCE; 2959 2960 static { 2961 DEFAULT_INSTANCE = new com.google.cloud.retail.v2.PredictRequest(); 2962 } 2963 getDefaultInstance()2964 public static com.google.cloud.retail.v2.PredictRequest getDefaultInstance() { 2965 return DEFAULT_INSTANCE; 2966 } 2967 2968 private static final com.google.protobuf.Parser<PredictRequest> PARSER = 2969 new com.google.protobuf.AbstractParser<PredictRequest>() { 2970 @java.lang.Override 2971 public PredictRequest parsePartialFrom( 2972 com.google.protobuf.CodedInputStream input, 2973 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2974 throws com.google.protobuf.InvalidProtocolBufferException { 2975 Builder builder = newBuilder(); 2976 try { 2977 builder.mergeFrom(input, extensionRegistry); 2978 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 2979 throw e.setUnfinishedMessage(builder.buildPartial()); 2980 } catch (com.google.protobuf.UninitializedMessageException e) { 2981 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 2982 } catch (java.io.IOException e) { 2983 throw new com.google.protobuf.InvalidProtocolBufferException(e) 2984 .setUnfinishedMessage(builder.buildPartial()); 2985 } 2986 return builder.buildPartial(); 2987 } 2988 }; 2989 parser()2990 public static com.google.protobuf.Parser<PredictRequest> parser() { 2991 return PARSER; 2992 } 2993 2994 @java.lang.Override getParserForType()2995 public com.google.protobuf.Parser<PredictRequest> getParserForType() { 2996 return PARSER; 2997 } 2998 2999 @java.lang.Override getDefaultInstanceForType()3000 public com.google.cloud.retail.v2.PredictRequest getDefaultInstanceForType() { 3001 return DEFAULT_INSTANCE; 3002 } 3003 } 3004