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/completion_service.proto 18 19 package com.google.cloud.retail.v2; 20 21 /** 22 * 23 * 24 * <pre> 25 * Autocomplete parameters. 26 * </pre> 27 * 28 * Protobuf type {@code google.cloud.retail.v2.CompleteQueryRequest} 29 */ 30 public final class CompleteQueryRequest extends com.google.protobuf.GeneratedMessageV3 31 implements 32 // @@protoc_insertion_point(message_implements:google.cloud.retail.v2.CompleteQueryRequest) 33 CompleteQueryRequestOrBuilder { 34 private static final long serialVersionUID = 0L; 35 // Use CompleteQueryRequest.newBuilder() to construct. CompleteQueryRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder)36 private CompleteQueryRequest(com.google.protobuf.GeneratedMessageV3.Builder<?> builder) { 37 super(builder); 38 } 39 CompleteQueryRequest()40 private CompleteQueryRequest() { 41 catalog_ = ""; 42 query_ = ""; 43 visitorId_ = ""; 44 languageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; 45 deviceType_ = ""; 46 dataset_ = ""; 47 entity_ = ""; 48 } 49 50 @java.lang.Override 51 @SuppressWarnings({"unused"}) newInstance(UnusedPrivateParameter unused)52 protected java.lang.Object newInstance(UnusedPrivateParameter unused) { 53 return new CompleteQueryRequest(); 54 } 55 56 @java.lang.Override getUnknownFields()57 public final com.google.protobuf.UnknownFieldSet getUnknownFields() { 58 return this.unknownFields; 59 } 60 getDescriptor()61 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 62 return com.google.cloud.retail.v2.CompletionServiceProto 63 .internal_static_google_cloud_retail_v2_CompleteQueryRequest_descriptor; 64 } 65 66 @java.lang.Override 67 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()68 internalGetFieldAccessorTable() { 69 return com.google.cloud.retail.v2.CompletionServiceProto 70 .internal_static_google_cloud_retail_v2_CompleteQueryRequest_fieldAccessorTable 71 .ensureFieldAccessorsInitialized( 72 com.google.cloud.retail.v2.CompleteQueryRequest.class, 73 com.google.cloud.retail.v2.CompleteQueryRequest.Builder.class); 74 } 75 76 public static final int CATALOG_FIELD_NUMBER = 1; 77 78 @SuppressWarnings("serial") 79 private volatile java.lang.Object catalog_ = ""; 80 /** 81 * 82 * 83 * <pre> 84 * Required. Catalog for which the completion is performed. 85 * Full resource name of catalog, such as 86 * `projects/*/locations/global/catalogs/default_catalog`. 87 * </pre> 88 * 89 * <code> 90 * string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 91 * </code> 92 * 93 * @return The catalog. 94 */ 95 @java.lang.Override getCatalog()96 public java.lang.String getCatalog() { 97 java.lang.Object ref = catalog_; 98 if (ref instanceof java.lang.String) { 99 return (java.lang.String) ref; 100 } else { 101 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 102 java.lang.String s = bs.toStringUtf8(); 103 catalog_ = s; 104 return s; 105 } 106 } 107 /** 108 * 109 * 110 * <pre> 111 * Required. Catalog for which the completion is performed. 112 * Full resource name of catalog, such as 113 * `projects/*/locations/global/catalogs/default_catalog`. 114 * </pre> 115 * 116 * <code> 117 * string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 118 * </code> 119 * 120 * @return The bytes for catalog. 121 */ 122 @java.lang.Override getCatalogBytes()123 public com.google.protobuf.ByteString getCatalogBytes() { 124 java.lang.Object ref = catalog_; 125 if (ref instanceof java.lang.String) { 126 com.google.protobuf.ByteString b = 127 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 128 catalog_ = b; 129 return b; 130 } else { 131 return (com.google.protobuf.ByteString) ref; 132 } 133 } 134 135 public static final int QUERY_FIELD_NUMBER = 2; 136 137 @SuppressWarnings("serial") 138 private volatile java.lang.Object query_ = ""; 139 /** 140 * 141 * 142 * <pre> 143 * Required. The query used to generate suggestions. 144 * The maximum number of allowed characters is 255. 145 * </pre> 146 * 147 * <code>string query = 2 [(.google.api.field_behavior) = REQUIRED];</code> 148 * 149 * @return The query. 150 */ 151 @java.lang.Override getQuery()152 public java.lang.String getQuery() { 153 java.lang.Object ref = query_; 154 if (ref instanceof java.lang.String) { 155 return (java.lang.String) ref; 156 } else { 157 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 158 java.lang.String s = bs.toStringUtf8(); 159 query_ = s; 160 return s; 161 } 162 } 163 /** 164 * 165 * 166 * <pre> 167 * Required. The query used to generate suggestions. 168 * The maximum number of allowed characters is 255. 169 * </pre> 170 * 171 * <code>string query = 2 [(.google.api.field_behavior) = REQUIRED];</code> 172 * 173 * @return The bytes for query. 174 */ 175 @java.lang.Override getQueryBytes()176 public com.google.protobuf.ByteString getQueryBytes() { 177 java.lang.Object ref = query_; 178 if (ref instanceof java.lang.String) { 179 com.google.protobuf.ByteString b = 180 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 181 query_ = b; 182 return b; 183 } else { 184 return (com.google.protobuf.ByteString) ref; 185 } 186 } 187 188 public static final int VISITOR_ID_FIELD_NUMBER = 7; 189 190 @SuppressWarnings("serial") 191 private volatile java.lang.Object visitorId_ = ""; 192 /** 193 * 194 * 195 * <pre> 196 * Required field. A unique identifier for tracking visitors. For example, 197 * this could be implemented with an HTTP cookie, which should be able to 198 * uniquely identify a visitor on a single device. This unique identifier 199 * should not change if the visitor logs in or out of the website. 200 * The field must be a UTF-8 encoded string with a length limit of 128 201 * characters. Otherwise, an INVALID_ARGUMENT error is returned. 202 * </pre> 203 * 204 * <code>string visitor_id = 7;</code> 205 * 206 * @return The visitorId. 207 */ 208 @java.lang.Override getVisitorId()209 public java.lang.String getVisitorId() { 210 java.lang.Object ref = visitorId_; 211 if (ref instanceof java.lang.String) { 212 return (java.lang.String) ref; 213 } else { 214 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 215 java.lang.String s = bs.toStringUtf8(); 216 visitorId_ = s; 217 return s; 218 } 219 } 220 /** 221 * 222 * 223 * <pre> 224 * Required field. A unique identifier for tracking visitors. For example, 225 * this could be implemented with an HTTP cookie, which should be able to 226 * uniquely identify a visitor on a single device. This unique identifier 227 * should not change if the visitor logs in or out of the website. 228 * The field must be a UTF-8 encoded string with a length limit of 128 229 * characters. Otherwise, an INVALID_ARGUMENT error is returned. 230 * </pre> 231 * 232 * <code>string visitor_id = 7;</code> 233 * 234 * @return The bytes for visitorId. 235 */ 236 @java.lang.Override getVisitorIdBytes()237 public com.google.protobuf.ByteString getVisitorIdBytes() { 238 java.lang.Object ref = visitorId_; 239 if (ref instanceof java.lang.String) { 240 com.google.protobuf.ByteString b = 241 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 242 visitorId_ = b; 243 return b; 244 } else { 245 return (com.google.protobuf.ByteString) ref; 246 } 247 } 248 249 public static final int LANGUAGE_CODES_FIELD_NUMBER = 3; 250 251 @SuppressWarnings("serial") 252 private com.google.protobuf.LazyStringList languageCodes_; 253 /** 254 * 255 * 256 * <pre> 257 * Note that this field applies for `user-data` dataset only. For requests 258 * with `cloud-retail` dataset, setting this field has no effect. 259 * The language filters applied to the output suggestions. If set, it should 260 * contain the language of the query. If not set, suggestions are returned 261 * without considering language restrictions. This is the BCP-47 language 262 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 263 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 264 * number of language codes is 3. 265 * </pre> 266 * 267 * <code>repeated string language_codes = 3;</code> 268 * 269 * @return A list containing the languageCodes. 270 */ getLanguageCodesList()271 public com.google.protobuf.ProtocolStringList getLanguageCodesList() { 272 return languageCodes_; 273 } 274 /** 275 * 276 * 277 * <pre> 278 * Note that this field applies for `user-data` dataset only. For requests 279 * with `cloud-retail` dataset, setting this field has no effect. 280 * The language filters applied to the output suggestions. If set, it should 281 * contain the language of the query. If not set, suggestions are returned 282 * without considering language restrictions. This is the BCP-47 language 283 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 284 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 285 * number of language codes is 3. 286 * </pre> 287 * 288 * <code>repeated string language_codes = 3;</code> 289 * 290 * @return The count of languageCodes. 291 */ getLanguageCodesCount()292 public int getLanguageCodesCount() { 293 return languageCodes_.size(); 294 } 295 /** 296 * 297 * 298 * <pre> 299 * Note that this field applies for `user-data` dataset only. For requests 300 * with `cloud-retail` dataset, setting this field has no effect. 301 * The language filters applied to the output suggestions. If set, it should 302 * contain the language of the query. If not set, suggestions are returned 303 * without considering language restrictions. This is the BCP-47 language 304 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 305 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 306 * number of language codes is 3. 307 * </pre> 308 * 309 * <code>repeated string language_codes = 3;</code> 310 * 311 * @param index The index of the element to return. 312 * @return The languageCodes at the given index. 313 */ getLanguageCodes(int index)314 public java.lang.String getLanguageCodes(int index) { 315 return languageCodes_.get(index); 316 } 317 /** 318 * 319 * 320 * <pre> 321 * Note that this field applies for `user-data` dataset only. For requests 322 * with `cloud-retail` dataset, setting this field has no effect. 323 * The language filters applied to the output suggestions. If set, it should 324 * contain the language of the query. If not set, suggestions are returned 325 * without considering language restrictions. This is the BCP-47 language 326 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 327 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 328 * number of language codes is 3. 329 * </pre> 330 * 331 * <code>repeated string language_codes = 3;</code> 332 * 333 * @param index The index of the value to return. 334 * @return The bytes of the languageCodes at the given index. 335 */ getLanguageCodesBytes(int index)336 public com.google.protobuf.ByteString getLanguageCodesBytes(int index) { 337 return languageCodes_.getByteString(index); 338 } 339 340 public static final int DEVICE_TYPE_FIELD_NUMBER = 4; 341 342 @SuppressWarnings("serial") 343 private volatile java.lang.Object deviceType_ = ""; 344 /** 345 * 346 * 347 * <pre> 348 * The device type context for completion suggestions. We recommend that you 349 * leave this field empty. 350 * It can apply different suggestions on different device types, e.g. 351 * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device 352 * types. 353 * Supported formats: 354 * * `UNKNOWN_DEVICE_TYPE` 355 * * `DESKTOP` 356 * * `MOBILE` 357 * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. 358 * </pre> 359 * 360 * <code>string device_type = 4;</code> 361 * 362 * @return The deviceType. 363 */ 364 @java.lang.Override getDeviceType()365 public java.lang.String getDeviceType() { 366 java.lang.Object ref = deviceType_; 367 if (ref instanceof java.lang.String) { 368 return (java.lang.String) ref; 369 } else { 370 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 371 java.lang.String s = bs.toStringUtf8(); 372 deviceType_ = s; 373 return s; 374 } 375 } 376 /** 377 * 378 * 379 * <pre> 380 * The device type context for completion suggestions. We recommend that you 381 * leave this field empty. 382 * It can apply different suggestions on different device types, e.g. 383 * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device 384 * types. 385 * Supported formats: 386 * * `UNKNOWN_DEVICE_TYPE` 387 * * `DESKTOP` 388 * * `MOBILE` 389 * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. 390 * </pre> 391 * 392 * <code>string device_type = 4;</code> 393 * 394 * @return The bytes for deviceType. 395 */ 396 @java.lang.Override getDeviceTypeBytes()397 public com.google.protobuf.ByteString getDeviceTypeBytes() { 398 java.lang.Object ref = deviceType_; 399 if (ref instanceof java.lang.String) { 400 com.google.protobuf.ByteString b = 401 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 402 deviceType_ = b; 403 return b; 404 } else { 405 return (com.google.protobuf.ByteString) ref; 406 } 407 } 408 409 public static final int DATASET_FIELD_NUMBER = 6; 410 411 @SuppressWarnings("serial") 412 private volatile java.lang.Object dataset_ = ""; 413 /** 414 * 415 * 416 * <pre> 417 * Determines which dataset to use for fetching completion. "user-data" will 418 * use the imported dataset through 419 * [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData]. 420 * "cloud-retail" will use the dataset generated by cloud retail based on user 421 * events. If leave empty, it will use the "user-data". 422 * Current supported values: 423 * * user-data 424 * * cloud-retail: 425 * This option requires enabling auto-learning function first. See 426 * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). 427 * </pre> 428 * 429 * <code>string dataset = 6;</code> 430 * 431 * @return The dataset. 432 */ 433 @java.lang.Override getDataset()434 public java.lang.String getDataset() { 435 java.lang.Object ref = dataset_; 436 if (ref instanceof java.lang.String) { 437 return (java.lang.String) ref; 438 } else { 439 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 440 java.lang.String s = bs.toStringUtf8(); 441 dataset_ = s; 442 return s; 443 } 444 } 445 /** 446 * 447 * 448 * <pre> 449 * Determines which dataset to use for fetching completion. "user-data" will 450 * use the imported dataset through 451 * [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData]. 452 * "cloud-retail" will use the dataset generated by cloud retail based on user 453 * events. If leave empty, it will use the "user-data". 454 * Current supported values: 455 * * user-data 456 * * cloud-retail: 457 * This option requires enabling auto-learning function first. See 458 * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). 459 * </pre> 460 * 461 * <code>string dataset = 6;</code> 462 * 463 * @return The bytes for dataset. 464 */ 465 @java.lang.Override getDatasetBytes()466 public com.google.protobuf.ByteString getDatasetBytes() { 467 java.lang.Object ref = dataset_; 468 if (ref instanceof java.lang.String) { 469 com.google.protobuf.ByteString b = 470 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 471 dataset_ = b; 472 return b; 473 } else { 474 return (com.google.protobuf.ByteString) ref; 475 } 476 } 477 478 public static final int MAX_SUGGESTIONS_FIELD_NUMBER = 5; 479 private int maxSuggestions_ = 0; 480 /** 481 * 482 * 483 * <pre> 484 * Completion max suggestions. If left unset or set to 0, then will fallback 485 * to the configured value 486 * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]. 487 * The maximum allowed max suggestions is 20. If it is set higher, it will be 488 * capped by 20. 489 * </pre> 490 * 491 * <code>int32 max_suggestions = 5;</code> 492 * 493 * @return The maxSuggestions. 494 */ 495 @java.lang.Override getMaxSuggestions()496 public int getMaxSuggestions() { 497 return maxSuggestions_; 498 } 499 500 public static final int ENTITY_FIELD_NUMBER = 10; 501 502 @SuppressWarnings("serial") 503 private volatile java.lang.Object entity_ = ""; 504 /** 505 * 506 * 507 * <pre> 508 * The entity for customers that may run multiple different entities, domains, 509 * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, 510 * `google.com`, `youtube.com`, etc. 511 * If this is set, it should be exactly matched with 512 * [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get 513 * per-entity autocomplete results. 514 * </pre> 515 * 516 * <code>string entity = 10;</code> 517 * 518 * @return The entity. 519 */ 520 @java.lang.Override getEntity()521 public java.lang.String getEntity() { 522 java.lang.Object ref = entity_; 523 if (ref instanceof java.lang.String) { 524 return (java.lang.String) ref; 525 } else { 526 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 527 java.lang.String s = bs.toStringUtf8(); 528 entity_ = s; 529 return s; 530 } 531 } 532 /** 533 * 534 * 535 * <pre> 536 * The entity for customers that may run multiple different entities, domains, 537 * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, 538 * `google.com`, `youtube.com`, etc. 539 * If this is set, it should be exactly matched with 540 * [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get 541 * per-entity autocomplete results. 542 * </pre> 543 * 544 * <code>string entity = 10;</code> 545 * 546 * @return The bytes for entity. 547 */ 548 @java.lang.Override getEntityBytes()549 public com.google.protobuf.ByteString getEntityBytes() { 550 java.lang.Object ref = entity_; 551 if (ref instanceof java.lang.String) { 552 com.google.protobuf.ByteString b = 553 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 554 entity_ = b; 555 return b; 556 } else { 557 return (com.google.protobuf.ByteString) ref; 558 } 559 } 560 561 private byte memoizedIsInitialized = -1; 562 563 @java.lang.Override isInitialized()564 public final boolean isInitialized() { 565 byte isInitialized = memoizedIsInitialized; 566 if (isInitialized == 1) return true; 567 if (isInitialized == 0) return false; 568 569 memoizedIsInitialized = 1; 570 return true; 571 } 572 573 @java.lang.Override writeTo(com.google.protobuf.CodedOutputStream output)574 public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { 575 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(catalog_)) { 576 com.google.protobuf.GeneratedMessageV3.writeString(output, 1, catalog_); 577 } 578 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(query_)) { 579 com.google.protobuf.GeneratedMessageV3.writeString(output, 2, query_); 580 } 581 for (int i = 0; i < languageCodes_.size(); i++) { 582 com.google.protobuf.GeneratedMessageV3.writeString(output, 3, languageCodes_.getRaw(i)); 583 } 584 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(deviceType_)) { 585 com.google.protobuf.GeneratedMessageV3.writeString(output, 4, deviceType_); 586 } 587 if (maxSuggestions_ != 0) { 588 output.writeInt32(5, maxSuggestions_); 589 } 590 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(dataset_)) { 591 com.google.protobuf.GeneratedMessageV3.writeString(output, 6, dataset_); 592 } 593 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(visitorId_)) { 594 com.google.protobuf.GeneratedMessageV3.writeString(output, 7, visitorId_); 595 } 596 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(entity_)) { 597 com.google.protobuf.GeneratedMessageV3.writeString(output, 10, entity_); 598 } 599 getUnknownFields().writeTo(output); 600 } 601 602 @java.lang.Override getSerializedSize()603 public int getSerializedSize() { 604 int size = memoizedSize; 605 if (size != -1) return size; 606 607 size = 0; 608 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(catalog_)) { 609 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, catalog_); 610 } 611 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(query_)) { 612 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(2, query_); 613 } 614 { 615 int dataSize = 0; 616 for (int i = 0; i < languageCodes_.size(); i++) { 617 dataSize += computeStringSizeNoTag(languageCodes_.getRaw(i)); 618 } 619 size += dataSize; 620 size += 1 * getLanguageCodesList().size(); 621 } 622 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(deviceType_)) { 623 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(4, deviceType_); 624 } 625 if (maxSuggestions_ != 0) { 626 size += com.google.protobuf.CodedOutputStream.computeInt32Size(5, maxSuggestions_); 627 } 628 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(dataset_)) { 629 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(6, dataset_); 630 } 631 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(visitorId_)) { 632 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(7, visitorId_); 633 } 634 if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(entity_)) { 635 size += com.google.protobuf.GeneratedMessageV3.computeStringSize(10, entity_); 636 } 637 size += getUnknownFields().getSerializedSize(); 638 memoizedSize = size; 639 return size; 640 } 641 642 @java.lang.Override equals(final java.lang.Object obj)643 public boolean equals(final java.lang.Object obj) { 644 if (obj == this) { 645 return true; 646 } 647 if (!(obj instanceof com.google.cloud.retail.v2.CompleteQueryRequest)) { 648 return super.equals(obj); 649 } 650 com.google.cloud.retail.v2.CompleteQueryRequest other = 651 (com.google.cloud.retail.v2.CompleteQueryRequest) obj; 652 653 if (!getCatalog().equals(other.getCatalog())) return false; 654 if (!getQuery().equals(other.getQuery())) return false; 655 if (!getVisitorId().equals(other.getVisitorId())) return false; 656 if (!getLanguageCodesList().equals(other.getLanguageCodesList())) return false; 657 if (!getDeviceType().equals(other.getDeviceType())) return false; 658 if (!getDataset().equals(other.getDataset())) return false; 659 if (getMaxSuggestions() != other.getMaxSuggestions()) return false; 660 if (!getEntity().equals(other.getEntity())) return false; 661 if (!getUnknownFields().equals(other.getUnknownFields())) return false; 662 return true; 663 } 664 665 @java.lang.Override hashCode()666 public int hashCode() { 667 if (memoizedHashCode != 0) { 668 return memoizedHashCode; 669 } 670 int hash = 41; 671 hash = (19 * hash) + getDescriptor().hashCode(); 672 hash = (37 * hash) + CATALOG_FIELD_NUMBER; 673 hash = (53 * hash) + getCatalog().hashCode(); 674 hash = (37 * hash) + QUERY_FIELD_NUMBER; 675 hash = (53 * hash) + getQuery().hashCode(); 676 hash = (37 * hash) + VISITOR_ID_FIELD_NUMBER; 677 hash = (53 * hash) + getVisitorId().hashCode(); 678 if (getLanguageCodesCount() > 0) { 679 hash = (37 * hash) + LANGUAGE_CODES_FIELD_NUMBER; 680 hash = (53 * hash) + getLanguageCodesList().hashCode(); 681 } 682 hash = (37 * hash) + DEVICE_TYPE_FIELD_NUMBER; 683 hash = (53 * hash) + getDeviceType().hashCode(); 684 hash = (37 * hash) + DATASET_FIELD_NUMBER; 685 hash = (53 * hash) + getDataset().hashCode(); 686 hash = (37 * hash) + MAX_SUGGESTIONS_FIELD_NUMBER; 687 hash = (53 * hash) + getMaxSuggestions(); 688 hash = (37 * hash) + ENTITY_FIELD_NUMBER; 689 hash = (53 * hash) + getEntity().hashCode(); 690 hash = (29 * hash) + getUnknownFields().hashCode(); 691 memoizedHashCode = hash; 692 return hash; 693 } 694 parseFrom(java.nio.ByteBuffer data)695 public static com.google.cloud.retail.v2.CompleteQueryRequest parseFrom(java.nio.ByteBuffer data) 696 throws com.google.protobuf.InvalidProtocolBufferException { 697 return PARSER.parseFrom(data); 698 } 699 parseFrom( java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)700 public static com.google.cloud.retail.v2.CompleteQueryRequest parseFrom( 701 java.nio.ByteBuffer data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 702 throws com.google.protobuf.InvalidProtocolBufferException { 703 return PARSER.parseFrom(data, extensionRegistry); 704 } 705 parseFrom( com.google.protobuf.ByteString data)706 public static com.google.cloud.retail.v2.CompleteQueryRequest parseFrom( 707 com.google.protobuf.ByteString data) 708 throws com.google.protobuf.InvalidProtocolBufferException { 709 return PARSER.parseFrom(data); 710 } 711 parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)712 public static com.google.cloud.retail.v2.CompleteQueryRequest parseFrom( 713 com.google.protobuf.ByteString data, 714 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 715 throws com.google.protobuf.InvalidProtocolBufferException { 716 return PARSER.parseFrom(data, extensionRegistry); 717 } 718 parseFrom(byte[] data)719 public static com.google.cloud.retail.v2.CompleteQueryRequest parseFrom(byte[] data) 720 throws com.google.protobuf.InvalidProtocolBufferException { 721 return PARSER.parseFrom(data); 722 } 723 parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry)724 public static com.google.cloud.retail.v2.CompleteQueryRequest parseFrom( 725 byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 726 throws com.google.protobuf.InvalidProtocolBufferException { 727 return PARSER.parseFrom(data, extensionRegistry); 728 } 729 parseFrom(java.io.InputStream input)730 public static com.google.cloud.retail.v2.CompleteQueryRequest parseFrom(java.io.InputStream input) 731 throws java.io.IOException { 732 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 733 } 734 parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)735 public static com.google.cloud.retail.v2.CompleteQueryRequest parseFrom( 736 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 737 throws java.io.IOException { 738 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 739 PARSER, input, extensionRegistry); 740 } 741 parseDelimitedFrom( java.io.InputStream input)742 public static com.google.cloud.retail.v2.CompleteQueryRequest parseDelimitedFrom( 743 java.io.InputStream input) throws java.io.IOException { 744 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException(PARSER, input); 745 } 746 parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)747 public static com.google.cloud.retail.v2.CompleteQueryRequest parseDelimitedFrom( 748 java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) 749 throws java.io.IOException { 750 return com.google.protobuf.GeneratedMessageV3.parseDelimitedWithIOException( 751 PARSER, input, extensionRegistry); 752 } 753 parseFrom( com.google.protobuf.CodedInputStream input)754 public static com.google.cloud.retail.v2.CompleteQueryRequest parseFrom( 755 com.google.protobuf.CodedInputStream input) throws java.io.IOException { 756 return com.google.protobuf.GeneratedMessageV3.parseWithIOException(PARSER, input); 757 } 758 parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)759 public static com.google.cloud.retail.v2.CompleteQueryRequest parseFrom( 760 com.google.protobuf.CodedInputStream input, 761 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 762 throws java.io.IOException { 763 return com.google.protobuf.GeneratedMessageV3.parseWithIOException( 764 PARSER, input, extensionRegistry); 765 } 766 767 @java.lang.Override newBuilderForType()768 public Builder newBuilderForType() { 769 return newBuilder(); 770 } 771 newBuilder()772 public static Builder newBuilder() { 773 return DEFAULT_INSTANCE.toBuilder(); 774 } 775 newBuilder(com.google.cloud.retail.v2.CompleteQueryRequest prototype)776 public static Builder newBuilder(com.google.cloud.retail.v2.CompleteQueryRequest prototype) { 777 return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); 778 } 779 780 @java.lang.Override toBuilder()781 public Builder toBuilder() { 782 return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); 783 } 784 785 @java.lang.Override newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)786 protected Builder newBuilderForType(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 787 Builder builder = new Builder(parent); 788 return builder; 789 } 790 /** 791 * 792 * 793 * <pre> 794 * Autocomplete parameters. 795 * </pre> 796 * 797 * Protobuf type {@code google.cloud.retail.v2.CompleteQueryRequest} 798 */ 799 public static final class Builder extends com.google.protobuf.GeneratedMessageV3.Builder<Builder> 800 implements 801 // @@protoc_insertion_point(builder_implements:google.cloud.retail.v2.CompleteQueryRequest) 802 com.google.cloud.retail.v2.CompleteQueryRequestOrBuilder { getDescriptor()803 public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { 804 return com.google.cloud.retail.v2.CompletionServiceProto 805 .internal_static_google_cloud_retail_v2_CompleteQueryRequest_descriptor; 806 } 807 808 @java.lang.Override 809 protected com.google.protobuf.GeneratedMessageV3.FieldAccessorTable internalGetFieldAccessorTable()810 internalGetFieldAccessorTable() { 811 return com.google.cloud.retail.v2.CompletionServiceProto 812 .internal_static_google_cloud_retail_v2_CompleteQueryRequest_fieldAccessorTable 813 .ensureFieldAccessorsInitialized( 814 com.google.cloud.retail.v2.CompleteQueryRequest.class, 815 com.google.cloud.retail.v2.CompleteQueryRequest.Builder.class); 816 } 817 818 // Construct using com.google.cloud.retail.v2.CompleteQueryRequest.newBuilder() Builder()819 private Builder() {} 820 Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent)821 private Builder(com.google.protobuf.GeneratedMessageV3.BuilderParent parent) { 822 super(parent); 823 } 824 825 @java.lang.Override clear()826 public Builder clear() { 827 super.clear(); 828 bitField0_ = 0; 829 catalog_ = ""; 830 query_ = ""; 831 visitorId_ = ""; 832 languageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; 833 bitField0_ = (bitField0_ & ~0x00000008); 834 deviceType_ = ""; 835 dataset_ = ""; 836 maxSuggestions_ = 0; 837 entity_ = ""; 838 return this; 839 } 840 841 @java.lang.Override getDescriptorForType()842 public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { 843 return com.google.cloud.retail.v2.CompletionServiceProto 844 .internal_static_google_cloud_retail_v2_CompleteQueryRequest_descriptor; 845 } 846 847 @java.lang.Override getDefaultInstanceForType()848 public com.google.cloud.retail.v2.CompleteQueryRequest getDefaultInstanceForType() { 849 return com.google.cloud.retail.v2.CompleteQueryRequest.getDefaultInstance(); 850 } 851 852 @java.lang.Override build()853 public com.google.cloud.retail.v2.CompleteQueryRequest build() { 854 com.google.cloud.retail.v2.CompleteQueryRequest result = buildPartial(); 855 if (!result.isInitialized()) { 856 throw newUninitializedMessageException(result); 857 } 858 return result; 859 } 860 861 @java.lang.Override buildPartial()862 public com.google.cloud.retail.v2.CompleteQueryRequest buildPartial() { 863 com.google.cloud.retail.v2.CompleteQueryRequest result = 864 new com.google.cloud.retail.v2.CompleteQueryRequest(this); 865 buildPartialRepeatedFields(result); 866 if (bitField0_ != 0) { 867 buildPartial0(result); 868 } 869 onBuilt(); 870 return result; 871 } 872 buildPartialRepeatedFields( com.google.cloud.retail.v2.CompleteQueryRequest result)873 private void buildPartialRepeatedFields( 874 com.google.cloud.retail.v2.CompleteQueryRequest result) { 875 if (((bitField0_ & 0x00000008) != 0)) { 876 languageCodes_ = languageCodes_.getUnmodifiableView(); 877 bitField0_ = (bitField0_ & ~0x00000008); 878 } 879 result.languageCodes_ = languageCodes_; 880 } 881 buildPartial0(com.google.cloud.retail.v2.CompleteQueryRequest result)882 private void buildPartial0(com.google.cloud.retail.v2.CompleteQueryRequest result) { 883 int from_bitField0_ = bitField0_; 884 if (((from_bitField0_ & 0x00000001) != 0)) { 885 result.catalog_ = catalog_; 886 } 887 if (((from_bitField0_ & 0x00000002) != 0)) { 888 result.query_ = query_; 889 } 890 if (((from_bitField0_ & 0x00000004) != 0)) { 891 result.visitorId_ = visitorId_; 892 } 893 if (((from_bitField0_ & 0x00000010) != 0)) { 894 result.deviceType_ = deviceType_; 895 } 896 if (((from_bitField0_ & 0x00000020) != 0)) { 897 result.dataset_ = dataset_; 898 } 899 if (((from_bitField0_ & 0x00000040) != 0)) { 900 result.maxSuggestions_ = maxSuggestions_; 901 } 902 if (((from_bitField0_ & 0x00000080) != 0)) { 903 result.entity_ = entity_; 904 } 905 } 906 907 @java.lang.Override clone()908 public Builder clone() { 909 return super.clone(); 910 } 911 912 @java.lang.Override setField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)913 public Builder setField( 914 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 915 return super.setField(field, value); 916 } 917 918 @java.lang.Override clearField(com.google.protobuf.Descriptors.FieldDescriptor field)919 public Builder clearField(com.google.protobuf.Descriptors.FieldDescriptor field) { 920 return super.clearField(field); 921 } 922 923 @java.lang.Override clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof)924 public Builder clearOneof(com.google.protobuf.Descriptors.OneofDescriptor oneof) { 925 return super.clearOneof(oneof); 926 } 927 928 @java.lang.Override setRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value)929 public Builder setRepeatedField( 930 com.google.protobuf.Descriptors.FieldDescriptor field, int index, java.lang.Object value) { 931 return super.setRepeatedField(field, index, value); 932 } 933 934 @java.lang.Override addRepeatedField( com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value)935 public Builder addRepeatedField( 936 com.google.protobuf.Descriptors.FieldDescriptor field, java.lang.Object value) { 937 return super.addRepeatedField(field, value); 938 } 939 940 @java.lang.Override mergeFrom(com.google.protobuf.Message other)941 public Builder mergeFrom(com.google.protobuf.Message other) { 942 if (other instanceof com.google.cloud.retail.v2.CompleteQueryRequest) { 943 return mergeFrom((com.google.cloud.retail.v2.CompleteQueryRequest) other); 944 } else { 945 super.mergeFrom(other); 946 return this; 947 } 948 } 949 mergeFrom(com.google.cloud.retail.v2.CompleteQueryRequest other)950 public Builder mergeFrom(com.google.cloud.retail.v2.CompleteQueryRequest other) { 951 if (other == com.google.cloud.retail.v2.CompleteQueryRequest.getDefaultInstance()) 952 return this; 953 if (!other.getCatalog().isEmpty()) { 954 catalog_ = other.catalog_; 955 bitField0_ |= 0x00000001; 956 onChanged(); 957 } 958 if (!other.getQuery().isEmpty()) { 959 query_ = other.query_; 960 bitField0_ |= 0x00000002; 961 onChanged(); 962 } 963 if (!other.getVisitorId().isEmpty()) { 964 visitorId_ = other.visitorId_; 965 bitField0_ |= 0x00000004; 966 onChanged(); 967 } 968 if (!other.languageCodes_.isEmpty()) { 969 if (languageCodes_.isEmpty()) { 970 languageCodes_ = other.languageCodes_; 971 bitField0_ = (bitField0_ & ~0x00000008); 972 } else { 973 ensureLanguageCodesIsMutable(); 974 languageCodes_.addAll(other.languageCodes_); 975 } 976 onChanged(); 977 } 978 if (!other.getDeviceType().isEmpty()) { 979 deviceType_ = other.deviceType_; 980 bitField0_ |= 0x00000010; 981 onChanged(); 982 } 983 if (!other.getDataset().isEmpty()) { 984 dataset_ = other.dataset_; 985 bitField0_ |= 0x00000020; 986 onChanged(); 987 } 988 if (other.getMaxSuggestions() != 0) { 989 setMaxSuggestions(other.getMaxSuggestions()); 990 } 991 if (!other.getEntity().isEmpty()) { 992 entity_ = other.entity_; 993 bitField0_ |= 0x00000080; 994 onChanged(); 995 } 996 this.mergeUnknownFields(other.getUnknownFields()); 997 onChanged(); 998 return this; 999 } 1000 1001 @java.lang.Override isInitialized()1002 public final boolean isInitialized() { 1003 return true; 1004 } 1005 1006 @java.lang.Override mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry)1007 public Builder mergeFrom( 1008 com.google.protobuf.CodedInputStream input, 1009 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 1010 throws java.io.IOException { 1011 if (extensionRegistry == null) { 1012 throw new java.lang.NullPointerException(); 1013 } 1014 try { 1015 boolean done = false; 1016 while (!done) { 1017 int tag = input.readTag(); 1018 switch (tag) { 1019 case 0: 1020 done = true; 1021 break; 1022 case 10: 1023 { 1024 catalog_ = input.readStringRequireUtf8(); 1025 bitField0_ |= 0x00000001; 1026 break; 1027 } // case 10 1028 case 18: 1029 { 1030 query_ = input.readStringRequireUtf8(); 1031 bitField0_ |= 0x00000002; 1032 break; 1033 } // case 18 1034 case 26: 1035 { 1036 java.lang.String s = input.readStringRequireUtf8(); 1037 ensureLanguageCodesIsMutable(); 1038 languageCodes_.add(s); 1039 break; 1040 } // case 26 1041 case 34: 1042 { 1043 deviceType_ = input.readStringRequireUtf8(); 1044 bitField0_ |= 0x00000010; 1045 break; 1046 } // case 34 1047 case 40: 1048 { 1049 maxSuggestions_ = input.readInt32(); 1050 bitField0_ |= 0x00000040; 1051 break; 1052 } // case 40 1053 case 50: 1054 { 1055 dataset_ = input.readStringRequireUtf8(); 1056 bitField0_ |= 0x00000020; 1057 break; 1058 } // case 50 1059 case 58: 1060 { 1061 visitorId_ = input.readStringRequireUtf8(); 1062 bitField0_ |= 0x00000004; 1063 break; 1064 } // case 58 1065 case 82: 1066 { 1067 entity_ = input.readStringRequireUtf8(); 1068 bitField0_ |= 0x00000080; 1069 break; 1070 } // case 82 1071 default: 1072 { 1073 if (!super.parseUnknownField(input, extensionRegistry, tag)) { 1074 done = true; // was an endgroup tag 1075 } 1076 break; 1077 } // default: 1078 } // switch (tag) 1079 } // while (!done) 1080 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 1081 throw e.unwrapIOException(); 1082 } finally { 1083 onChanged(); 1084 } // finally 1085 return this; 1086 } 1087 1088 private int bitField0_; 1089 1090 private java.lang.Object catalog_ = ""; 1091 /** 1092 * 1093 * 1094 * <pre> 1095 * Required. Catalog for which the completion is performed. 1096 * Full resource name of catalog, such as 1097 * `projects/*/locations/global/catalogs/default_catalog`. 1098 * </pre> 1099 * 1100 * <code> 1101 * string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 1102 * </code> 1103 * 1104 * @return The catalog. 1105 */ getCatalog()1106 public java.lang.String getCatalog() { 1107 java.lang.Object ref = catalog_; 1108 if (!(ref instanceof java.lang.String)) { 1109 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1110 java.lang.String s = bs.toStringUtf8(); 1111 catalog_ = s; 1112 return s; 1113 } else { 1114 return (java.lang.String) ref; 1115 } 1116 } 1117 /** 1118 * 1119 * 1120 * <pre> 1121 * Required. Catalog for which the completion is performed. 1122 * Full resource name of catalog, such as 1123 * `projects/*/locations/global/catalogs/default_catalog`. 1124 * </pre> 1125 * 1126 * <code> 1127 * string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 1128 * </code> 1129 * 1130 * @return The bytes for catalog. 1131 */ getCatalogBytes()1132 public com.google.protobuf.ByteString getCatalogBytes() { 1133 java.lang.Object ref = catalog_; 1134 if (ref instanceof String) { 1135 com.google.protobuf.ByteString b = 1136 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1137 catalog_ = b; 1138 return b; 1139 } else { 1140 return (com.google.protobuf.ByteString) ref; 1141 } 1142 } 1143 /** 1144 * 1145 * 1146 * <pre> 1147 * Required. Catalog for which the completion is performed. 1148 * Full resource name of catalog, such as 1149 * `projects/*/locations/global/catalogs/default_catalog`. 1150 * </pre> 1151 * 1152 * <code> 1153 * string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 1154 * </code> 1155 * 1156 * @param value The catalog to set. 1157 * @return This builder for chaining. 1158 */ setCatalog(java.lang.String value)1159 public Builder setCatalog(java.lang.String value) { 1160 if (value == null) { 1161 throw new NullPointerException(); 1162 } 1163 catalog_ = value; 1164 bitField0_ |= 0x00000001; 1165 onChanged(); 1166 return this; 1167 } 1168 /** 1169 * 1170 * 1171 * <pre> 1172 * Required. Catalog for which the completion is performed. 1173 * Full resource name of catalog, such as 1174 * `projects/*/locations/global/catalogs/default_catalog`. 1175 * </pre> 1176 * 1177 * <code> 1178 * string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 1179 * </code> 1180 * 1181 * @return This builder for chaining. 1182 */ clearCatalog()1183 public Builder clearCatalog() { 1184 catalog_ = getDefaultInstance().getCatalog(); 1185 bitField0_ = (bitField0_ & ~0x00000001); 1186 onChanged(); 1187 return this; 1188 } 1189 /** 1190 * 1191 * 1192 * <pre> 1193 * Required. Catalog for which the completion is performed. 1194 * Full resource name of catalog, such as 1195 * `projects/*/locations/global/catalogs/default_catalog`. 1196 * </pre> 1197 * 1198 * <code> 1199 * string catalog = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { ... } 1200 * </code> 1201 * 1202 * @param value The bytes for catalog to set. 1203 * @return This builder for chaining. 1204 */ setCatalogBytes(com.google.protobuf.ByteString value)1205 public Builder setCatalogBytes(com.google.protobuf.ByteString value) { 1206 if (value == null) { 1207 throw new NullPointerException(); 1208 } 1209 checkByteStringIsUtf8(value); 1210 catalog_ = value; 1211 bitField0_ |= 0x00000001; 1212 onChanged(); 1213 return this; 1214 } 1215 1216 private java.lang.Object query_ = ""; 1217 /** 1218 * 1219 * 1220 * <pre> 1221 * Required. The query used to generate suggestions. 1222 * The maximum number of allowed characters is 255. 1223 * </pre> 1224 * 1225 * <code>string query = 2 [(.google.api.field_behavior) = REQUIRED];</code> 1226 * 1227 * @return The query. 1228 */ getQuery()1229 public java.lang.String getQuery() { 1230 java.lang.Object ref = query_; 1231 if (!(ref instanceof java.lang.String)) { 1232 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1233 java.lang.String s = bs.toStringUtf8(); 1234 query_ = s; 1235 return s; 1236 } else { 1237 return (java.lang.String) ref; 1238 } 1239 } 1240 /** 1241 * 1242 * 1243 * <pre> 1244 * Required. The query used to generate suggestions. 1245 * The maximum number of allowed characters is 255. 1246 * </pre> 1247 * 1248 * <code>string query = 2 [(.google.api.field_behavior) = REQUIRED];</code> 1249 * 1250 * @return The bytes for query. 1251 */ getQueryBytes()1252 public com.google.protobuf.ByteString getQueryBytes() { 1253 java.lang.Object ref = query_; 1254 if (ref instanceof String) { 1255 com.google.protobuf.ByteString b = 1256 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1257 query_ = b; 1258 return b; 1259 } else { 1260 return (com.google.protobuf.ByteString) ref; 1261 } 1262 } 1263 /** 1264 * 1265 * 1266 * <pre> 1267 * Required. The query used to generate suggestions. 1268 * The maximum number of allowed characters is 255. 1269 * </pre> 1270 * 1271 * <code>string query = 2 [(.google.api.field_behavior) = REQUIRED];</code> 1272 * 1273 * @param value The query to set. 1274 * @return This builder for chaining. 1275 */ setQuery(java.lang.String value)1276 public Builder setQuery(java.lang.String value) { 1277 if (value == null) { 1278 throw new NullPointerException(); 1279 } 1280 query_ = value; 1281 bitField0_ |= 0x00000002; 1282 onChanged(); 1283 return this; 1284 } 1285 /** 1286 * 1287 * 1288 * <pre> 1289 * Required. The query used to generate suggestions. 1290 * The maximum number of allowed characters is 255. 1291 * </pre> 1292 * 1293 * <code>string query = 2 [(.google.api.field_behavior) = REQUIRED];</code> 1294 * 1295 * @return This builder for chaining. 1296 */ clearQuery()1297 public Builder clearQuery() { 1298 query_ = getDefaultInstance().getQuery(); 1299 bitField0_ = (bitField0_ & ~0x00000002); 1300 onChanged(); 1301 return this; 1302 } 1303 /** 1304 * 1305 * 1306 * <pre> 1307 * Required. The query used to generate suggestions. 1308 * The maximum number of allowed characters is 255. 1309 * </pre> 1310 * 1311 * <code>string query = 2 [(.google.api.field_behavior) = REQUIRED];</code> 1312 * 1313 * @param value The bytes for query to set. 1314 * @return This builder for chaining. 1315 */ setQueryBytes(com.google.protobuf.ByteString value)1316 public Builder setQueryBytes(com.google.protobuf.ByteString value) { 1317 if (value == null) { 1318 throw new NullPointerException(); 1319 } 1320 checkByteStringIsUtf8(value); 1321 query_ = value; 1322 bitField0_ |= 0x00000002; 1323 onChanged(); 1324 return this; 1325 } 1326 1327 private java.lang.Object visitorId_ = ""; 1328 /** 1329 * 1330 * 1331 * <pre> 1332 * Required field. A unique identifier for tracking visitors. For example, 1333 * this could be implemented with an HTTP cookie, which should be able to 1334 * uniquely identify a visitor on a single device. This unique identifier 1335 * should not change if the visitor logs in or out of the website. 1336 * The field must be a UTF-8 encoded string with a length limit of 128 1337 * characters. Otherwise, an INVALID_ARGUMENT error is returned. 1338 * </pre> 1339 * 1340 * <code>string visitor_id = 7;</code> 1341 * 1342 * @return The visitorId. 1343 */ getVisitorId()1344 public java.lang.String getVisitorId() { 1345 java.lang.Object ref = visitorId_; 1346 if (!(ref instanceof java.lang.String)) { 1347 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1348 java.lang.String s = bs.toStringUtf8(); 1349 visitorId_ = s; 1350 return s; 1351 } else { 1352 return (java.lang.String) ref; 1353 } 1354 } 1355 /** 1356 * 1357 * 1358 * <pre> 1359 * Required field. A unique identifier for tracking visitors. For example, 1360 * this could be implemented with an HTTP cookie, which should be able to 1361 * uniquely identify a visitor on a single device. This unique identifier 1362 * should not change if the visitor logs in or out of the website. 1363 * The field must be a UTF-8 encoded string with a length limit of 128 1364 * characters. Otherwise, an INVALID_ARGUMENT error is returned. 1365 * </pre> 1366 * 1367 * <code>string visitor_id = 7;</code> 1368 * 1369 * @return The bytes for visitorId. 1370 */ getVisitorIdBytes()1371 public com.google.protobuf.ByteString getVisitorIdBytes() { 1372 java.lang.Object ref = visitorId_; 1373 if (ref instanceof String) { 1374 com.google.protobuf.ByteString b = 1375 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1376 visitorId_ = b; 1377 return b; 1378 } else { 1379 return (com.google.protobuf.ByteString) ref; 1380 } 1381 } 1382 /** 1383 * 1384 * 1385 * <pre> 1386 * Required field. A unique identifier for tracking visitors. For example, 1387 * this could be implemented with an HTTP cookie, which should be able to 1388 * uniquely identify a visitor on a single device. This unique identifier 1389 * should not change if the visitor logs in or out of the website. 1390 * The field must be a UTF-8 encoded string with a length limit of 128 1391 * characters. Otherwise, an INVALID_ARGUMENT error is returned. 1392 * </pre> 1393 * 1394 * <code>string visitor_id = 7;</code> 1395 * 1396 * @param value The visitorId to set. 1397 * @return This builder for chaining. 1398 */ setVisitorId(java.lang.String value)1399 public Builder setVisitorId(java.lang.String value) { 1400 if (value == null) { 1401 throw new NullPointerException(); 1402 } 1403 visitorId_ = value; 1404 bitField0_ |= 0x00000004; 1405 onChanged(); 1406 return this; 1407 } 1408 /** 1409 * 1410 * 1411 * <pre> 1412 * Required field. A unique identifier for tracking visitors. For example, 1413 * this could be implemented with an HTTP cookie, which should be able to 1414 * uniquely identify a visitor on a single device. This unique identifier 1415 * should not change if the visitor logs in or out of the website. 1416 * The field must be a UTF-8 encoded string with a length limit of 128 1417 * characters. Otherwise, an INVALID_ARGUMENT error is returned. 1418 * </pre> 1419 * 1420 * <code>string visitor_id = 7;</code> 1421 * 1422 * @return This builder for chaining. 1423 */ clearVisitorId()1424 public Builder clearVisitorId() { 1425 visitorId_ = getDefaultInstance().getVisitorId(); 1426 bitField0_ = (bitField0_ & ~0x00000004); 1427 onChanged(); 1428 return this; 1429 } 1430 /** 1431 * 1432 * 1433 * <pre> 1434 * Required field. A unique identifier for tracking visitors. For example, 1435 * this could be implemented with an HTTP cookie, which should be able to 1436 * uniquely identify a visitor on a single device. This unique identifier 1437 * should not change if the visitor logs in or out of the website. 1438 * The field must be a UTF-8 encoded string with a length limit of 128 1439 * characters. Otherwise, an INVALID_ARGUMENT error is returned. 1440 * </pre> 1441 * 1442 * <code>string visitor_id = 7;</code> 1443 * 1444 * @param value The bytes for visitorId to set. 1445 * @return This builder for chaining. 1446 */ setVisitorIdBytes(com.google.protobuf.ByteString value)1447 public Builder setVisitorIdBytes(com.google.protobuf.ByteString value) { 1448 if (value == null) { 1449 throw new NullPointerException(); 1450 } 1451 checkByteStringIsUtf8(value); 1452 visitorId_ = value; 1453 bitField0_ |= 0x00000004; 1454 onChanged(); 1455 return this; 1456 } 1457 1458 private com.google.protobuf.LazyStringList languageCodes_ = 1459 com.google.protobuf.LazyStringArrayList.EMPTY; 1460 ensureLanguageCodesIsMutable()1461 private void ensureLanguageCodesIsMutable() { 1462 if (!((bitField0_ & 0x00000008) != 0)) { 1463 languageCodes_ = new com.google.protobuf.LazyStringArrayList(languageCodes_); 1464 bitField0_ |= 0x00000008; 1465 } 1466 } 1467 /** 1468 * 1469 * 1470 * <pre> 1471 * Note that this field applies for `user-data` dataset only. For requests 1472 * with `cloud-retail` dataset, setting this field has no effect. 1473 * The language filters applied to the output suggestions. If set, it should 1474 * contain the language of the query. If not set, suggestions are returned 1475 * without considering language restrictions. This is the BCP-47 language 1476 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 1477 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 1478 * number of language codes is 3. 1479 * </pre> 1480 * 1481 * <code>repeated string language_codes = 3;</code> 1482 * 1483 * @return A list containing the languageCodes. 1484 */ getLanguageCodesList()1485 public com.google.protobuf.ProtocolStringList getLanguageCodesList() { 1486 return languageCodes_.getUnmodifiableView(); 1487 } 1488 /** 1489 * 1490 * 1491 * <pre> 1492 * Note that this field applies for `user-data` dataset only. For requests 1493 * with `cloud-retail` dataset, setting this field has no effect. 1494 * The language filters applied to the output suggestions. If set, it should 1495 * contain the language of the query. If not set, suggestions are returned 1496 * without considering language restrictions. This is the BCP-47 language 1497 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 1498 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 1499 * number of language codes is 3. 1500 * </pre> 1501 * 1502 * <code>repeated string language_codes = 3;</code> 1503 * 1504 * @return The count of languageCodes. 1505 */ getLanguageCodesCount()1506 public int getLanguageCodesCount() { 1507 return languageCodes_.size(); 1508 } 1509 /** 1510 * 1511 * 1512 * <pre> 1513 * Note that this field applies for `user-data` dataset only. For requests 1514 * with `cloud-retail` dataset, setting this field has no effect. 1515 * The language filters applied to the output suggestions. If set, it should 1516 * contain the language of the query. If not set, suggestions are returned 1517 * without considering language restrictions. This is the BCP-47 language 1518 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 1519 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 1520 * number of language codes is 3. 1521 * </pre> 1522 * 1523 * <code>repeated string language_codes = 3;</code> 1524 * 1525 * @param index The index of the element to return. 1526 * @return The languageCodes at the given index. 1527 */ getLanguageCodes(int index)1528 public java.lang.String getLanguageCodes(int index) { 1529 return languageCodes_.get(index); 1530 } 1531 /** 1532 * 1533 * 1534 * <pre> 1535 * Note that this field applies for `user-data` dataset only. For requests 1536 * with `cloud-retail` dataset, setting this field has no effect. 1537 * The language filters applied to the output suggestions. If set, it should 1538 * contain the language of the query. If not set, suggestions are returned 1539 * without considering language restrictions. This is the BCP-47 language 1540 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 1541 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 1542 * number of language codes is 3. 1543 * </pre> 1544 * 1545 * <code>repeated string language_codes = 3;</code> 1546 * 1547 * @param index The index of the value to return. 1548 * @return The bytes of the languageCodes at the given index. 1549 */ getLanguageCodesBytes(int index)1550 public com.google.protobuf.ByteString getLanguageCodesBytes(int index) { 1551 return languageCodes_.getByteString(index); 1552 } 1553 /** 1554 * 1555 * 1556 * <pre> 1557 * Note that this field applies for `user-data` dataset only. For requests 1558 * with `cloud-retail` dataset, setting this field has no effect. 1559 * The language filters applied to the output suggestions. If set, it should 1560 * contain the language of the query. If not set, suggestions are returned 1561 * without considering language restrictions. This is the BCP-47 language 1562 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 1563 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 1564 * number of language codes is 3. 1565 * </pre> 1566 * 1567 * <code>repeated string language_codes = 3;</code> 1568 * 1569 * @param index The index to set the value at. 1570 * @param value The languageCodes to set. 1571 * @return This builder for chaining. 1572 */ setLanguageCodes(int index, java.lang.String value)1573 public Builder setLanguageCodes(int index, java.lang.String value) { 1574 if (value == null) { 1575 throw new NullPointerException(); 1576 } 1577 ensureLanguageCodesIsMutable(); 1578 languageCodes_.set(index, value); 1579 onChanged(); 1580 return this; 1581 } 1582 /** 1583 * 1584 * 1585 * <pre> 1586 * Note that this field applies for `user-data` dataset only. For requests 1587 * with `cloud-retail` dataset, setting this field has no effect. 1588 * The language filters applied to the output suggestions. If set, it should 1589 * contain the language of the query. If not set, suggestions are returned 1590 * without considering language restrictions. This is the BCP-47 language 1591 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 1592 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 1593 * number of language codes is 3. 1594 * </pre> 1595 * 1596 * <code>repeated string language_codes = 3;</code> 1597 * 1598 * @param value The languageCodes to add. 1599 * @return This builder for chaining. 1600 */ addLanguageCodes(java.lang.String value)1601 public Builder addLanguageCodes(java.lang.String value) { 1602 if (value == null) { 1603 throw new NullPointerException(); 1604 } 1605 ensureLanguageCodesIsMutable(); 1606 languageCodes_.add(value); 1607 onChanged(); 1608 return this; 1609 } 1610 /** 1611 * 1612 * 1613 * <pre> 1614 * Note that this field applies for `user-data` dataset only. For requests 1615 * with `cloud-retail` dataset, setting this field has no effect. 1616 * The language filters applied to the output suggestions. If set, it should 1617 * contain the language of the query. If not set, suggestions are returned 1618 * without considering language restrictions. This is the BCP-47 language 1619 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 1620 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 1621 * number of language codes is 3. 1622 * </pre> 1623 * 1624 * <code>repeated string language_codes = 3;</code> 1625 * 1626 * @param values The languageCodes to add. 1627 * @return This builder for chaining. 1628 */ addAllLanguageCodes(java.lang.Iterable<java.lang.String> values)1629 public Builder addAllLanguageCodes(java.lang.Iterable<java.lang.String> values) { 1630 ensureLanguageCodesIsMutable(); 1631 com.google.protobuf.AbstractMessageLite.Builder.addAll(values, languageCodes_); 1632 onChanged(); 1633 return this; 1634 } 1635 /** 1636 * 1637 * 1638 * <pre> 1639 * Note that this field applies for `user-data` dataset only. For requests 1640 * with `cloud-retail` dataset, setting this field has no effect. 1641 * The language filters applied to the output suggestions. If set, it should 1642 * contain the language of the query. If not set, suggestions are returned 1643 * without considering language restrictions. This is the BCP-47 language 1644 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 1645 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 1646 * number of language codes is 3. 1647 * </pre> 1648 * 1649 * <code>repeated string language_codes = 3;</code> 1650 * 1651 * @return This builder for chaining. 1652 */ clearLanguageCodes()1653 public Builder clearLanguageCodes() { 1654 languageCodes_ = com.google.protobuf.LazyStringArrayList.EMPTY; 1655 bitField0_ = (bitField0_ & ~0x00000008); 1656 onChanged(); 1657 return this; 1658 } 1659 /** 1660 * 1661 * 1662 * <pre> 1663 * Note that this field applies for `user-data` dataset only. For requests 1664 * with `cloud-retail` dataset, setting this field has no effect. 1665 * The language filters applied to the output suggestions. If set, it should 1666 * contain the language of the query. If not set, suggestions are returned 1667 * without considering language restrictions. This is the BCP-47 language 1668 * code, such as "en-US" or "sr-Latn". For more information, see [Tags for 1669 * Identifying Languages](https://tools.ietf.org/html/bcp47). The maximum 1670 * number of language codes is 3. 1671 * </pre> 1672 * 1673 * <code>repeated string language_codes = 3;</code> 1674 * 1675 * @param value The bytes of the languageCodes to add. 1676 * @return This builder for chaining. 1677 */ addLanguageCodesBytes(com.google.protobuf.ByteString value)1678 public Builder addLanguageCodesBytes(com.google.protobuf.ByteString value) { 1679 if (value == null) { 1680 throw new NullPointerException(); 1681 } 1682 checkByteStringIsUtf8(value); 1683 ensureLanguageCodesIsMutable(); 1684 languageCodes_.add(value); 1685 onChanged(); 1686 return this; 1687 } 1688 1689 private java.lang.Object deviceType_ = ""; 1690 /** 1691 * 1692 * 1693 * <pre> 1694 * The device type context for completion suggestions. We recommend that you 1695 * leave this field empty. 1696 * It can apply different suggestions on different device types, e.g. 1697 * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device 1698 * types. 1699 * Supported formats: 1700 * * `UNKNOWN_DEVICE_TYPE` 1701 * * `DESKTOP` 1702 * * `MOBILE` 1703 * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. 1704 * </pre> 1705 * 1706 * <code>string device_type = 4;</code> 1707 * 1708 * @return The deviceType. 1709 */ getDeviceType()1710 public java.lang.String getDeviceType() { 1711 java.lang.Object ref = deviceType_; 1712 if (!(ref instanceof java.lang.String)) { 1713 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1714 java.lang.String s = bs.toStringUtf8(); 1715 deviceType_ = s; 1716 return s; 1717 } else { 1718 return (java.lang.String) ref; 1719 } 1720 } 1721 /** 1722 * 1723 * 1724 * <pre> 1725 * The device type context for completion suggestions. We recommend that you 1726 * leave this field empty. 1727 * It can apply different suggestions on different device types, e.g. 1728 * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device 1729 * types. 1730 * Supported formats: 1731 * * `UNKNOWN_DEVICE_TYPE` 1732 * * `DESKTOP` 1733 * * `MOBILE` 1734 * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. 1735 * </pre> 1736 * 1737 * <code>string device_type = 4;</code> 1738 * 1739 * @return The bytes for deviceType. 1740 */ getDeviceTypeBytes()1741 public com.google.protobuf.ByteString getDeviceTypeBytes() { 1742 java.lang.Object ref = deviceType_; 1743 if (ref instanceof String) { 1744 com.google.protobuf.ByteString b = 1745 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1746 deviceType_ = b; 1747 return b; 1748 } else { 1749 return (com.google.protobuf.ByteString) ref; 1750 } 1751 } 1752 /** 1753 * 1754 * 1755 * <pre> 1756 * The device type context for completion suggestions. We recommend that you 1757 * leave this field empty. 1758 * It can apply different suggestions on different device types, e.g. 1759 * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device 1760 * types. 1761 * Supported formats: 1762 * * `UNKNOWN_DEVICE_TYPE` 1763 * * `DESKTOP` 1764 * * `MOBILE` 1765 * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. 1766 * </pre> 1767 * 1768 * <code>string device_type = 4;</code> 1769 * 1770 * @param value The deviceType to set. 1771 * @return This builder for chaining. 1772 */ setDeviceType(java.lang.String value)1773 public Builder setDeviceType(java.lang.String value) { 1774 if (value == null) { 1775 throw new NullPointerException(); 1776 } 1777 deviceType_ = value; 1778 bitField0_ |= 0x00000010; 1779 onChanged(); 1780 return this; 1781 } 1782 /** 1783 * 1784 * 1785 * <pre> 1786 * The device type context for completion suggestions. We recommend that you 1787 * leave this field empty. 1788 * It can apply different suggestions on different device types, e.g. 1789 * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device 1790 * types. 1791 * Supported formats: 1792 * * `UNKNOWN_DEVICE_TYPE` 1793 * * `DESKTOP` 1794 * * `MOBILE` 1795 * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. 1796 * </pre> 1797 * 1798 * <code>string device_type = 4;</code> 1799 * 1800 * @return This builder for chaining. 1801 */ clearDeviceType()1802 public Builder clearDeviceType() { 1803 deviceType_ = getDefaultInstance().getDeviceType(); 1804 bitField0_ = (bitField0_ & ~0x00000010); 1805 onChanged(); 1806 return this; 1807 } 1808 /** 1809 * 1810 * 1811 * <pre> 1812 * The device type context for completion suggestions. We recommend that you 1813 * leave this field empty. 1814 * It can apply different suggestions on different device types, e.g. 1815 * `DESKTOP`, `MOBILE`. If it is empty, the suggestions are across all device 1816 * types. 1817 * Supported formats: 1818 * * `UNKNOWN_DEVICE_TYPE` 1819 * * `DESKTOP` 1820 * * `MOBILE` 1821 * * A customized string starts with `OTHER_`, e.g. `OTHER_IPHONE`. 1822 * </pre> 1823 * 1824 * <code>string device_type = 4;</code> 1825 * 1826 * @param value The bytes for deviceType to set. 1827 * @return This builder for chaining. 1828 */ setDeviceTypeBytes(com.google.protobuf.ByteString value)1829 public Builder setDeviceTypeBytes(com.google.protobuf.ByteString value) { 1830 if (value == null) { 1831 throw new NullPointerException(); 1832 } 1833 checkByteStringIsUtf8(value); 1834 deviceType_ = value; 1835 bitField0_ |= 0x00000010; 1836 onChanged(); 1837 return this; 1838 } 1839 1840 private java.lang.Object dataset_ = ""; 1841 /** 1842 * 1843 * 1844 * <pre> 1845 * Determines which dataset to use for fetching completion. "user-data" will 1846 * use the imported dataset through 1847 * [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData]. 1848 * "cloud-retail" will use the dataset generated by cloud retail based on user 1849 * events. If leave empty, it will use the "user-data". 1850 * Current supported values: 1851 * * user-data 1852 * * cloud-retail: 1853 * This option requires enabling auto-learning function first. See 1854 * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). 1855 * </pre> 1856 * 1857 * <code>string dataset = 6;</code> 1858 * 1859 * @return The dataset. 1860 */ getDataset()1861 public java.lang.String getDataset() { 1862 java.lang.Object ref = dataset_; 1863 if (!(ref instanceof java.lang.String)) { 1864 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 1865 java.lang.String s = bs.toStringUtf8(); 1866 dataset_ = s; 1867 return s; 1868 } else { 1869 return (java.lang.String) ref; 1870 } 1871 } 1872 /** 1873 * 1874 * 1875 * <pre> 1876 * Determines which dataset to use for fetching completion. "user-data" will 1877 * use the imported dataset through 1878 * [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData]. 1879 * "cloud-retail" will use the dataset generated by cloud retail based on user 1880 * events. If leave empty, it will use the "user-data". 1881 * Current supported values: 1882 * * user-data 1883 * * cloud-retail: 1884 * This option requires enabling auto-learning function first. See 1885 * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). 1886 * </pre> 1887 * 1888 * <code>string dataset = 6;</code> 1889 * 1890 * @return The bytes for dataset. 1891 */ getDatasetBytes()1892 public com.google.protobuf.ByteString getDatasetBytes() { 1893 java.lang.Object ref = dataset_; 1894 if (ref instanceof String) { 1895 com.google.protobuf.ByteString b = 1896 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 1897 dataset_ = b; 1898 return b; 1899 } else { 1900 return (com.google.protobuf.ByteString) ref; 1901 } 1902 } 1903 /** 1904 * 1905 * 1906 * <pre> 1907 * Determines which dataset to use for fetching completion. "user-data" will 1908 * use the imported dataset through 1909 * [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData]. 1910 * "cloud-retail" will use the dataset generated by cloud retail based on user 1911 * events. If leave empty, it will use the "user-data". 1912 * Current supported values: 1913 * * user-data 1914 * * cloud-retail: 1915 * This option requires enabling auto-learning function first. See 1916 * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). 1917 * </pre> 1918 * 1919 * <code>string dataset = 6;</code> 1920 * 1921 * @param value The dataset to set. 1922 * @return This builder for chaining. 1923 */ setDataset(java.lang.String value)1924 public Builder setDataset(java.lang.String value) { 1925 if (value == null) { 1926 throw new NullPointerException(); 1927 } 1928 dataset_ = value; 1929 bitField0_ |= 0x00000020; 1930 onChanged(); 1931 return this; 1932 } 1933 /** 1934 * 1935 * 1936 * <pre> 1937 * Determines which dataset to use for fetching completion. "user-data" will 1938 * use the imported dataset through 1939 * [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData]. 1940 * "cloud-retail" will use the dataset generated by cloud retail based on user 1941 * events. If leave empty, it will use the "user-data". 1942 * Current supported values: 1943 * * user-data 1944 * * cloud-retail: 1945 * This option requires enabling auto-learning function first. See 1946 * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). 1947 * </pre> 1948 * 1949 * <code>string dataset = 6;</code> 1950 * 1951 * @return This builder for chaining. 1952 */ clearDataset()1953 public Builder clearDataset() { 1954 dataset_ = getDefaultInstance().getDataset(); 1955 bitField0_ = (bitField0_ & ~0x00000020); 1956 onChanged(); 1957 return this; 1958 } 1959 /** 1960 * 1961 * 1962 * <pre> 1963 * Determines which dataset to use for fetching completion. "user-data" will 1964 * use the imported dataset through 1965 * [CompletionService.ImportCompletionData][google.cloud.retail.v2.CompletionService.ImportCompletionData]. 1966 * "cloud-retail" will use the dataset generated by cloud retail based on user 1967 * events. If leave empty, it will use the "user-data". 1968 * Current supported values: 1969 * * user-data 1970 * * cloud-retail: 1971 * This option requires enabling auto-learning function first. See 1972 * [guidelines](https://cloud.google.com/retail/docs/completion-overview#generated-completion-dataset). 1973 * </pre> 1974 * 1975 * <code>string dataset = 6;</code> 1976 * 1977 * @param value The bytes for dataset to set. 1978 * @return This builder for chaining. 1979 */ setDatasetBytes(com.google.protobuf.ByteString value)1980 public Builder setDatasetBytes(com.google.protobuf.ByteString value) { 1981 if (value == null) { 1982 throw new NullPointerException(); 1983 } 1984 checkByteStringIsUtf8(value); 1985 dataset_ = value; 1986 bitField0_ |= 0x00000020; 1987 onChanged(); 1988 return this; 1989 } 1990 1991 private int maxSuggestions_; 1992 /** 1993 * 1994 * 1995 * <pre> 1996 * Completion max suggestions. If left unset or set to 0, then will fallback 1997 * to the configured value 1998 * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]. 1999 * The maximum allowed max suggestions is 20. If it is set higher, it will be 2000 * capped by 20. 2001 * </pre> 2002 * 2003 * <code>int32 max_suggestions = 5;</code> 2004 * 2005 * @return The maxSuggestions. 2006 */ 2007 @java.lang.Override getMaxSuggestions()2008 public int getMaxSuggestions() { 2009 return maxSuggestions_; 2010 } 2011 /** 2012 * 2013 * 2014 * <pre> 2015 * Completion max suggestions. If left unset or set to 0, then will fallback 2016 * to the configured value 2017 * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]. 2018 * The maximum allowed max suggestions is 20. If it is set higher, it will be 2019 * capped by 20. 2020 * </pre> 2021 * 2022 * <code>int32 max_suggestions = 5;</code> 2023 * 2024 * @param value The maxSuggestions to set. 2025 * @return This builder for chaining. 2026 */ setMaxSuggestions(int value)2027 public Builder setMaxSuggestions(int value) { 2028 2029 maxSuggestions_ = value; 2030 bitField0_ |= 0x00000040; 2031 onChanged(); 2032 return this; 2033 } 2034 /** 2035 * 2036 * 2037 * <pre> 2038 * Completion max suggestions. If left unset or set to 0, then will fallback 2039 * to the configured value 2040 * [CompletionConfig.max_suggestions][google.cloud.retail.v2.CompletionConfig.max_suggestions]. 2041 * The maximum allowed max suggestions is 20. If it is set higher, it will be 2042 * capped by 20. 2043 * </pre> 2044 * 2045 * <code>int32 max_suggestions = 5;</code> 2046 * 2047 * @return This builder for chaining. 2048 */ clearMaxSuggestions()2049 public Builder clearMaxSuggestions() { 2050 bitField0_ = (bitField0_ & ~0x00000040); 2051 maxSuggestions_ = 0; 2052 onChanged(); 2053 return this; 2054 } 2055 2056 private java.lang.Object entity_ = ""; 2057 /** 2058 * 2059 * 2060 * <pre> 2061 * The entity for customers that may run multiple different entities, domains, 2062 * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, 2063 * `google.com`, `youtube.com`, etc. 2064 * If this is set, it should be exactly matched with 2065 * [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get 2066 * per-entity autocomplete results. 2067 * </pre> 2068 * 2069 * <code>string entity = 10;</code> 2070 * 2071 * @return The entity. 2072 */ getEntity()2073 public java.lang.String getEntity() { 2074 java.lang.Object ref = entity_; 2075 if (!(ref instanceof java.lang.String)) { 2076 com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; 2077 java.lang.String s = bs.toStringUtf8(); 2078 entity_ = s; 2079 return s; 2080 } else { 2081 return (java.lang.String) ref; 2082 } 2083 } 2084 /** 2085 * 2086 * 2087 * <pre> 2088 * The entity for customers that may run multiple different entities, domains, 2089 * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, 2090 * `google.com`, `youtube.com`, etc. 2091 * If this is set, it should be exactly matched with 2092 * [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get 2093 * per-entity autocomplete results. 2094 * </pre> 2095 * 2096 * <code>string entity = 10;</code> 2097 * 2098 * @return The bytes for entity. 2099 */ getEntityBytes()2100 public com.google.protobuf.ByteString getEntityBytes() { 2101 java.lang.Object ref = entity_; 2102 if (ref instanceof String) { 2103 com.google.protobuf.ByteString b = 2104 com.google.protobuf.ByteString.copyFromUtf8((java.lang.String) ref); 2105 entity_ = b; 2106 return b; 2107 } else { 2108 return (com.google.protobuf.ByteString) ref; 2109 } 2110 } 2111 /** 2112 * 2113 * 2114 * <pre> 2115 * The entity for customers that may run multiple different entities, domains, 2116 * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, 2117 * `google.com`, `youtube.com`, etc. 2118 * If this is set, it should be exactly matched with 2119 * [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get 2120 * per-entity autocomplete results. 2121 * </pre> 2122 * 2123 * <code>string entity = 10;</code> 2124 * 2125 * @param value The entity to set. 2126 * @return This builder for chaining. 2127 */ setEntity(java.lang.String value)2128 public Builder setEntity(java.lang.String value) { 2129 if (value == null) { 2130 throw new NullPointerException(); 2131 } 2132 entity_ = value; 2133 bitField0_ |= 0x00000080; 2134 onChanged(); 2135 return this; 2136 } 2137 /** 2138 * 2139 * 2140 * <pre> 2141 * The entity for customers that may run multiple different entities, domains, 2142 * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, 2143 * `google.com`, `youtube.com`, etc. 2144 * If this is set, it should be exactly matched with 2145 * [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get 2146 * per-entity autocomplete results. 2147 * </pre> 2148 * 2149 * <code>string entity = 10;</code> 2150 * 2151 * @return This builder for chaining. 2152 */ clearEntity()2153 public Builder clearEntity() { 2154 entity_ = getDefaultInstance().getEntity(); 2155 bitField0_ = (bitField0_ & ~0x00000080); 2156 onChanged(); 2157 return this; 2158 } 2159 /** 2160 * 2161 * 2162 * <pre> 2163 * The entity for customers that may run multiple different entities, domains, 2164 * sites or regions, for example, `Google US`, `Google Ads`, `Waymo`, 2165 * `google.com`, `youtube.com`, etc. 2166 * If this is set, it should be exactly matched with 2167 * [UserEvent.entity][google.cloud.retail.v2.UserEvent.entity] to get 2168 * per-entity autocomplete results. 2169 * </pre> 2170 * 2171 * <code>string entity = 10;</code> 2172 * 2173 * @param value The bytes for entity to set. 2174 * @return This builder for chaining. 2175 */ setEntityBytes(com.google.protobuf.ByteString value)2176 public Builder setEntityBytes(com.google.protobuf.ByteString value) { 2177 if (value == null) { 2178 throw new NullPointerException(); 2179 } 2180 checkByteStringIsUtf8(value); 2181 entity_ = value; 2182 bitField0_ |= 0x00000080; 2183 onChanged(); 2184 return this; 2185 } 2186 2187 @java.lang.Override setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields)2188 public final Builder setUnknownFields(final com.google.protobuf.UnknownFieldSet unknownFields) { 2189 return super.setUnknownFields(unknownFields); 2190 } 2191 2192 @java.lang.Override mergeUnknownFields( final com.google.protobuf.UnknownFieldSet unknownFields)2193 public final Builder mergeUnknownFields( 2194 final com.google.protobuf.UnknownFieldSet unknownFields) { 2195 return super.mergeUnknownFields(unknownFields); 2196 } 2197 2198 // @@protoc_insertion_point(builder_scope:google.cloud.retail.v2.CompleteQueryRequest) 2199 } 2200 2201 // @@protoc_insertion_point(class_scope:google.cloud.retail.v2.CompleteQueryRequest) 2202 private static final com.google.cloud.retail.v2.CompleteQueryRequest DEFAULT_INSTANCE; 2203 2204 static { 2205 DEFAULT_INSTANCE = new com.google.cloud.retail.v2.CompleteQueryRequest(); 2206 } 2207 getDefaultInstance()2208 public static com.google.cloud.retail.v2.CompleteQueryRequest getDefaultInstance() { 2209 return DEFAULT_INSTANCE; 2210 } 2211 2212 private static final com.google.protobuf.Parser<CompleteQueryRequest> PARSER = 2213 new com.google.protobuf.AbstractParser<CompleteQueryRequest>() { 2214 @java.lang.Override 2215 public CompleteQueryRequest parsePartialFrom( 2216 com.google.protobuf.CodedInputStream input, 2217 com.google.protobuf.ExtensionRegistryLite extensionRegistry) 2218 throws com.google.protobuf.InvalidProtocolBufferException { 2219 Builder builder = newBuilder(); 2220 try { 2221 builder.mergeFrom(input, extensionRegistry); 2222 } catch (com.google.protobuf.InvalidProtocolBufferException e) { 2223 throw e.setUnfinishedMessage(builder.buildPartial()); 2224 } catch (com.google.protobuf.UninitializedMessageException e) { 2225 throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial()); 2226 } catch (java.io.IOException e) { 2227 throw new com.google.protobuf.InvalidProtocolBufferException(e) 2228 .setUnfinishedMessage(builder.buildPartial()); 2229 } 2230 return builder.buildPartial(); 2231 } 2232 }; 2233 parser()2234 public static com.google.protobuf.Parser<CompleteQueryRequest> parser() { 2235 return PARSER; 2236 } 2237 2238 @java.lang.Override getParserForType()2239 public com.google.protobuf.Parser<CompleteQueryRequest> getParserForType() { 2240 return PARSER; 2241 } 2242 2243 @java.lang.Override getDefaultInstanceForType()2244 public com.google.cloud.retail.v2.CompleteQueryRequest getDefaultInstanceForType() { 2245 return DEFAULT_INSTANCE; 2246 } 2247 } 2248