diff --git a/DiscoveryEngine/metadata/V1/Answer.php b/DiscoveryEngine/metadata/V1/Answer.php new file mode 100644 index 000000000000..5be4009e5304 Binary files /dev/null and b/DiscoveryEngine/metadata/V1/Answer.php differ diff --git a/DiscoveryEngine/metadata/V1/Common.php b/DiscoveryEngine/metadata/V1/Common.php index f75a7503f709..6efb461445e1 100644 Binary files a/DiscoveryEngine/metadata/V1/Common.php and b/DiscoveryEngine/metadata/V1/Common.php differ diff --git a/DiscoveryEngine/metadata/V1/Control.php b/DiscoveryEngine/metadata/V1/Control.php new file mode 100644 index 000000000000..940ff56533a7 Binary files /dev/null and b/DiscoveryEngine/metadata/V1/Control.php differ diff --git a/DiscoveryEngine/metadata/V1/ControlService.php b/DiscoveryEngine/metadata/V1/ControlService.php new file mode 100644 index 000000000000..466b78fa7df1 --- /dev/null +++ b/DiscoveryEngine/metadata/V1/ControlService.php @@ -0,0 +1,64 @@ +internalAddGeneratedFile( + ' + +5google/cloud/discoveryengine/v1/control_service.protogoogle.cloud.discoveryengine.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto-google/cloud/discoveryengine/v1/control.protogoogle/protobuf/empty.proto google/protobuf/field_mask.proto" +CreateControlRequest> +parent ( B.AA(&discoveryengine.googleapis.com/Control> +control ( 2(.google.cloud.discoveryengine.v1.ControlBA + +control_id ( BA" +UpdateControlRequest> +control ( 2(.google.cloud.discoveryengine.v1.ControlBA4 + update_mask ( 2.google.protobuf.FieldMaskBA"T +DeleteControlRequest< +name ( B.AA( +&discoveryengine.googleapis.com/Control"Q +GetControlRequest< +name ( B.AA( +&discoveryengine.googleapis.com/Control" +ListControlsRequest> +parent ( B.AA(&discoveryengine.googleapis.com/Control + page_size (BA + +page_token ( BA +filter ( BA"k +ListControlsResponse: +controls ( 2(.google.cloud.discoveryengine.v1.Control +next_page_token ( 2 +ControlService + CreateControl5.google.cloud.discoveryengine.v1.CreateControlRequest(.google.cloud.discoveryengine.v1.Control"Aparent,control,control_id"9/v1/{parent=projects/*/locations/*/dataStores/*}/controls:controlZR"G/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/controls:controlZO"D/v1/{parent=projects/*/locations/*/collections/*/engines/*}/controls:control + DeleteControl5.google.cloud.discoveryengine.v1.DeleteControlRequest.google.protobuf.Empty"Aname*9/v1/{name=projects/*/locations/*/dataStores/*/controls/*}ZI*G/v1/{name=projects/*/locations/*/collections/*/dataStores/*/controls/*}ZF*D/v1/{name=projects/*/locations/*/collections/*/engines/*/controls/*} + UpdateControl5.google.cloud.discoveryengine.v1.UpdateControlRequest(.google.cloud.discoveryengine.v1.Control"Acontrol,update_mask2A/v1/{control.name=projects/*/locations/*/dataStores/*/controls/*}:controlZZ2O/v1/{control.name=projects/*/locations/*/collections/*/dataStores/*/controls/*}:controlZW2L/v1/{control.name=projects/*/locations/*/collections/*/engines/*/controls/*}:control + +GetControl2.google.cloud.discoveryengine.v1.GetControlRequest(.google.cloud.discoveryengine.v1.Control"Aname9/v1/{name=projects/*/locations/*/dataStores/*/controls/*}ZIG/v1/{name=projects/*/locations/*/collections/*/dataStores/*/controls/*}ZFD/v1/{name=projects/*/locations/*/collections/*/engines/*/controls/*} + ListControls4.google.cloud.discoveryengine.v1.ListControlsRequest5.google.cloud.discoveryengine.v1.ListControlsResponse"Aparent9/v1/{parent=projects/*/locations/*/dataStores/*}/controlsZIG/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/controlsZFD/v1/{parent=projects/*/locations/*/collections/*/engines/*}/controlsRAdiscoveryengine.googleapis.comA.https://www.googleapis.com/auth/cloud-platformB +#com.google.cloud.discoveryengine.v1BControlServiceProtoPZMcloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepbDISCOVERYENGINEGoogle.Cloud.DiscoveryEngine.V1Google\\Cloud\\DiscoveryEngine\\V1"Google::Cloud::DiscoveryEngine::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DiscoveryEngine/metadata/V1/ConversationalSearchService.php b/DiscoveryEngine/metadata/V1/ConversationalSearchService.php index 0b644cdc5ec4..88351832b322 100644 Binary files a/DiscoveryEngine/metadata/V1/ConversationalSearchService.php and b/DiscoveryEngine/metadata/V1/ConversationalSearchService.php differ diff --git a/DiscoveryEngine/metadata/V1/DataStore.php b/DiscoveryEngine/metadata/V1/DataStore.php index 7bf1c3558ea0..37038364070b 100644 Binary files a/DiscoveryEngine/metadata/V1/DataStore.php and b/DiscoveryEngine/metadata/V1/DataStore.php differ diff --git a/DiscoveryEngine/metadata/V1/DocumentProcessingConfig.php b/DiscoveryEngine/metadata/V1/DocumentProcessingConfig.php new file mode 100644 index 000000000000..aa27b86ff0cc Binary files /dev/null and b/DiscoveryEngine/metadata/V1/DocumentProcessingConfig.php differ diff --git a/DiscoveryEngine/metadata/V1/Engine.php b/DiscoveryEngine/metadata/V1/Engine.php index cfcf58661c97..dc42397e8e7e 100644 Binary files a/DiscoveryEngine/metadata/V1/Engine.php and b/DiscoveryEngine/metadata/V1/Engine.php differ diff --git a/DiscoveryEngine/metadata/V1/GroundedGenerationService.php b/DiscoveryEngine/metadata/V1/GroundedGenerationService.php new file mode 100644 index 000000000000..ef9d4069acf9 Binary files /dev/null and b/DiscoveryEngine/metadata/V1/GroundedGenerationService.php differ diff --git a/DiscoveryEngine/metadata/V1/Grounding.php b/DiscoveryEngine/metadata/V1/Grounding.php new file mode 100644 index 000000000000..25019b5ab18a --- /dev/null +++ b/DiscoveryEngine/metadata/V1/Grounding.php @@ -0,0 +1,45 @@ +internalAddGeneratedFile( + ' + +/google/cloud/discoveryengine/v1/grounding.protogoogle.cloud.discoveryengine.v1google/api/resource.proto" + GroundingFact + fact_text ( R + +attributes ( 2>.google.cloud.discoveryengine.v1.GroundingFact.AttributesEntry1 +AttributesEntry +key (  +value ( :8" + FactChunk + +chunk_text (  +source (  +index (W +source_metadata ( 2>.google.cloud.discoveryengine.v1.FactChunk.SourceMetadataEntry5 +SourceMetadataEntry +key (  +value ( :8B +#com.google.cloud.discoveryengine.v1BGroundingProtoPZMcloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepbDISCOVERYENGINEGoogle.Cloud.DiscoveryEngine.V1Google\\Cloud\\DiscoveryEngine\\V1"Google::Cloud::DiscoveryEngine::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DiscoveryEngine/metadata/V1/Project.php b/DiscoveryEngine/metadata/V1/Project.php new file mode 100644 index 000000000000..6ad84e8d39bc Binary files /dev/null and b/DiscoveryEngine/metadata/V1/Project.php differ diff --git a/DiscoveryEngine/metadata/V1/ProjectService.php b/DiscoveryEngine/metadata/V1/ProjectService.php new file mode 100644 index 000000000000..7330a9a5783d --- /dev/null +++ b/DiscoveryEngine/metadata/V1/ProjectService.php @@ -0,0 +1,42 @@ +internalAddGeneratedFile( + ' + +5google/cloud/discoveryengine/v1/project_service.protogoogle.cloud.discoveryengine.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto-google/cloud/discoveryengine/v1/project.proto#google/longrunning/operations.proto" +ProvisionProjectRequest< +name ( B.AA( +&discoveryengine.googleapis.com/Project" +accept_data_use_terms (BA# +data_use_terms_version ( BA" +ProvisionProjectMetadata2 +ProjectService +ProvisionProject8.google.cloud.discoveryengine.v1.ProvisionProjectRequest.google.longrunning.Operation"Ac +\'google.cloud.discoveryengine.v1.Project8google.cloud.discoveryengine.v1.ProvisionProjectMetadataAname$"/v1/{name=projects/*}:provision:*RAdiscoveryengine.googleapis.comA.https://www.googleapis.com/auth/cloud-platformB +#com.google.cloud.discoveryengine.v1BProjectServiceProtoPZMcloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepbDISCOVERYENGINEGoogle.Cloud.DiscoveryEngine.V1Google\\Cloud\\DiscoveryEngine\\V1"Google::Cloud::DiscoveryEngine::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DiscoveryEngine/metadata/V1/RankService.php b/DiscoveryEngine/metadata/V1/RankService.php new file mode 100644 index 000000000000..9b9c7cdccf17 --- /dev/null +++ b/DiscoveryEngine/metadata/V1/RankService.php @@ -0,0 +1,53 @@ +internalAddGeneratedFile( + ' + +2google/cloud/discoveryengine/v1/rank_service.protogoogle.cloud.discoveryengine.v1google/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto"J + RankingRecord + +id (  +title (  +content (  +score (" + RankRequestL +ranking_config ( B4AA. +,discoveryengine.googleapis.com/RankingConfig +model (  +top_n ( +query ( D +records ( 2..google.cloud.discoveryengine.v1.RankingRecordBA) +!ignore_record_details_in_response (Q + user_labels ( 2<.google.cloud.discoveryengine.v1.RankRequest.UserLabelsEntry1 +UserLabelsEntry +key (  +value ( :8"O + RankResponse? +records ( 2..google.cloud.discoveryengine.v1.RankingRecord2 + RankService +Rank,.google.cloud.discoveryengine.v1.RankRequest-.google.cloud.discoveryengine.v1.RankResponse"LF"A/v1/{ranking_config=projects/*/locations/*/rankingConfigs/*}:rank:*RAdiscoveryengine.googleapis.comA.https://www.googleapis.com/auth/cloud-platformB +#com.google.cloud.discoveryengine.v1BRankServiceProtoPZMcloud.google.com/go/discoveryengine/apiv1/discoveryenginepb;discoveryenginepbDISCOVERYENGINEGoogle.Cloud.DiscoveryEngine.V1Google\\Cloud\\DiscoveryEngine\\V1"Google::Cloud::DiscoveryEngine::V1bproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DiscoveryEngine/metadata/V1/Session.php b/DiscoveryEngine/metadata/V1/Session.php new file mode 100644 index 000000000000..4ab8e1f02908 Binary files /dev/null and b/DiscoveryEngine/metadata/V1/Session.php differ diff --git a/DiscoveryEngine/metadata/V1/SiteSearchEngine.php b/DiscoveryEngine/metadata/V1/SiteSearchEngine.php index 1c43d2aaa01b..ea682ab9f66b 100644 Binary files a/DiscoveryEngine/metadata/V1/SiteSearchEngine.php and b/DiscoveryEngine/metadata/V1/SiteSearchEngine.php differ diff --git a/DiscoveryEngine/metadata/V1/UserEvent.php b/DiscoveryEngine/metadata/V1/UserEvent.php index 57cb4bf0501d..83e21dbfd707 100644 Binary files a/DiscoveryEngine/metadata/V1/UserEvent.php and b/DiscoveryEngine/metadata/V1/UserEvent.php differ diff --git a/DiscoveryEngine/metadata/V1/UserEventService.php b/DiscoveryEngine/metadata/V1/UserEventService.php index b6b2576738ee..f5a9196b186a 100644 Binary files a/DiscoveryEngine/metadata/V1/UserEventService.php and b/DiscoveryEngine/metadata/V1/UserEventService.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/Answer.php b/DiscoveryEngine/metadata/V1Beta/Answer.php index fe9d77eac858..a90ee0e322e7 100644 Binary files a/DiscoveryEngine/metadata/V1Beta/Answer.php and b/DiscoveryEngine/metadata/V1Beta/Answer.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/Common.php b/DiscoveryEngine/metadata/V1Beta/Common.php index 3b157a327cc8..c0135c9238e6 100644 Binary files a/DiscoveryEngine/metadata/V1Beta/Common.php and b/DiscoveryEngine/metadata/V1Beta/Common.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/Control.php b/DiscoveryEngine/metadata/V1Beta/Control.php new file mode 100644 index 000000000000..333723bb6bb5 Binary files /dev/null and b/DiscoveryEngine/metadata/V1Beta/Control.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/ControlService.php b/DiscoveryEngine/metadata/V1Beta/ControlService.php new file mode 100644 index 000000000000..535ca94676e0 --- /dev/null +++ b/DiscoveryEngine/metadata/V1Beta/ControlService.php @@ -0,0 +1,64 @@ +internalAddGeneratedFile( + ' + +9google/cloud/discoveryengine/v1beta/control_service.proto#google.cloud.discoveryengine.v1betagoogle/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto1google/cloud/discoveryengine/v1beta/control.protogoogle/protobuf/empty.proto google/protobuf/field_mask.proto" +CreateControlRequest> +parent ( B.AA(&discoveryengine.googleapis.com/ControlB +control ( 2,.google.cloud.discoveryengine.v1beta.ControlBA + +control_id ( BA" +UpdateControlRequestB +control ( 2,.google.cloud.discoveryengine.v1beta.ControlBA4 + update_mask ( 2.google.protobuf.FieldMaskBA"T +DeleteControlRequest< +name ( B.AA( +&discoveryengine.googleapis.com/Control"Q +GetControlRequest< +name ( B.AA( +&discoveryengine.googleapis.com/Control" +ListControlsRequest> +parent ( B.AA(&discoveryengine.googleapis.com/Control + page_size (BA + +page_token ( BA +filter ( BA"o +ListControlsResponse> +controls ( 2,.google.cloud.discoveryengine.v1beta.Control +next_page_token ( 2 +ControlService + CreateControl9.google.cloud.discoveryengine.v1beta.CreateControlRequest,.google.cloud.discoveryengine.v1beta.Control"Aparent,control,control_id"=/v1beta/{parent=projects/*/locations/*/dataStores/*}/controls:controlZV"K/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/controls:controlZS"H/v1beta/{parent=projects/*/locations/*/collections/*/engines/*}/controls:control + DeleteControl9.google.cloud.discoveryengine.v1beta.DeleteControlRequest.google.protobuf.Empty"Aname*=/v1beta/{name=projects/*/locations/*/dataStores/*/controls/*}ZM*K/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/controls/*}ZJ*H/v1beta/{name=projects/*/locations/*/collections/*/engines/*/controls/*} + UpdateControl9.google.cloud.discoveryengine.v1beta.UpdateControlRequest,.google.cloud.discoveryengine.v1beta.Control"Acontrol,update_mask2E/v1beta/{control.name=projects/*/locations/*/dataStores/*/controls/*}:controlZ^2S/v1beta/{control.name=projects/*/locations/*/collections/*/dataStores/*/controls/*}:controlZ[2P/v1beta/{control.name=projects/*/locations/*/collections/*/engines/*/controls/*}:control + +GetControl6.google.cloud.discoveryengine.v1beta.GetControlRequest,.google.cloud.discoveryengine.v1beta.Control"Aname=/v1beta/{name=projects/*/locations/*/dataStores/*/controls/*}ZMK/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/controls/*}ZJH/v1beta/{name=projects/*/locations/*/collections/*/engines/*/controls/*} + ListControls8.google.cloud.discoveryengine.v1beta.ListControlsRequest9.google.cloud.discoveryengine.v1beta.ListControlsResponse"Aparent=/v1beta/{parent=projects/*/locations/*/dataStores/*}/controlsZMK/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/controlsZJH/v1beta/{parent=projects/*/locations/*/collections/*/engines/*}/controlsRAdiscoveryengine.googleapis.comA.https://www.googleapis.com/auth/cloud-platformB +\'com.google.cloud.discoveryengine.v1betaBControlServiceProtoPZQcloud.google.com/go/discoveryengine/apiv1beta/discoveryenginepb;discoveryenginepbDISCOVERYENGINE#Google.Cloud.DiscoveryEngine.V1Beta#Google\\Cloud\\DiscoveryEngine\\V1beta&Google::Cloud::DiscoveryEngine::V1betabproto3' + , true); + + static::$is_initialized = true; + } +} + diff --git a/DiscoveryEngine/metadata/V1Beta/ConversationalSearchService.php b/DiscoveryEngine/metadata/V1Beta/ConversationalSearchService.php index 9b0d05a51f50..e479f8875b1f 100644 Binary files a/DiscoveryEngine/metadata/V1Beta/ConversationalSearchService.php and b/DiscoveryEngine/metadata/V1Beta/ConversationalSearchService.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/CustomTuningModel.php b/DiscoveryEngine/metadata/V1Beta/CustomTuningModel.php new file mode 100644 index 000000000000..7f23440ffe60 Binary files /dev/null and b/DiscoveryEngine/metadata/V1Beta/CustomTuningModel.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/Engine.php b/DiscoveryEngine/metadata/V1Beta/Engine.php index 4d779d8a90e9..5ef3bad18614 100644 Binary files a/DiscoveryEngine/metadata/V1Beta/Engine.php and b/DiscoveryEngine/metadata/V1Beta/Engine.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/GroundedGenerationService.php b/DiscoveryEngine/metadata/V1Beta/GroundedGenerationService.php index 6d119eb82287..d6a36d9d717c 100644 Binary files a/DiscoveryEngine/metadata/V1Beta/GroundedGenerationService.php and b/DiscoveryEngine/metadata/V1Beta/GroundedGenerationService.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/Grounding.php b/DiscoveryEngine/metadata/V1Beta/Grounding.php index 0416d35cca2c..ef1d81f221c4 100644 --- a/DiscoveryEngine/metadata/V1Beta/Grounding.php +++ b/DiscoveryEngine/metadata/V1Beta/Grounding.php @@ -18,7 +18,7 @@ public static function initOnce() { \GPBMetadata\Google\Api\Resource::initOnce(); $pool->internalAddGeneratedFile( ' - + 3google/cloud/discoveryengine/v1beta/grounding.proto#google.cloud.discoveryengine.v1betagoogle/api/resource.proto" GroundingFact fact_text ( V @@ -26,11 +26,12 @@ public static function initOnce() { attributes ( 2B.google.cloud.discoveryengine.v1beta.GroundingFact.AttributesEntry1 AttributesEntry key (  -value ( :8" +value ( :8" FactChunk chunk_text (  -source ( [ +source (  +index ([ source_metadata ( 2B.google.cloud.discoveryengine.v1beta.FactChunk.SourceMetadataEntry5 SourceMetadataEntry key (  diff --git a/DiscoveryEngine/metadata/V1Beta/Project.php b/DiscoveryEngine/metadata/V1Beta/Project.php new file mode 100644 index 000000000000..f6f9670e1424 Binary files /dev/null and b/DiscoveryEngine/metadata/V1Beta/Project.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/ProjectService.php b/DiscoveryEngine/metadata/V1Beta/ProjectService.php new file mode 100644 index 000000000000..4ac09bda9a2e --- /dev/null +++ b/DiscoveryEngine/metadata/V1Beta/ProjectService.php @@ -0,0 +1,42 @@ +internalAddGeneratedFile( + ' + +9google/cloud/discoveryengine/v1beta/project_service.proto#google.cloud.discoveryengine.v1betagoogle/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto1google/cloud/discoveryengine/v1beta/project.proto#google/longrunning/operations.proto" +ProvisionProjectRequest< +name ( B.AA( +&discoveryengine.googleapis.com/Project" +accept_data_use_terms (BA# +data_use_terms_version ( BA" +ProvisionProjectMetadata2 +ProjectService +ProvisionProject<.google.cloud.discoveryengine.v1beta.ProvisionProjectRequest.google.longrunning.Operation"Ak ++google.cloud.discoveryengine.v1beta.ProjectinternalAddGeneratedFile( ' - + + 6google/cloud/discoveryengine/v1beta/rank_service.proto#google.cloud.discoveryengine.v1betagoogle/api/client.protogoogle/api/field_behavior.protogoogle/api/resource.proto"J RankingRecord id (  title (  content (  -score (" +score (" RankRequestL ranking_config ( B4AA. ,discoveryengine.googleapis.com/RankingConfig @@ -35,7 +36,11 @@ public static function initOnce() { top_n ( query ( H records ( 22.google.cloud.discoveryengine.v1beta.RankingRecordBA) -!ignore_record_details_in_response ("S +!ignore_record_details_in_response (U + user_labels ( 2@.google.cloud.discoveryengine.v1beta.RankRequest.UserLabelsEntry1 +UserLabelsEntry +key (  +value ( :8"S RankResponseC records ( 22.google.cloud.discoveryengine.v1beta.RankingRecord2 RankService diff --git a/DiscoveryEngine/metadata/V1Beta/SearchTuningService.php b/DiscoveryEngine/metadata/V1Beta/SearchTuningService.php index 2bcf5b08ec26..a6d04d920111 100644 Binary files a/DiscoveryEngine/metadata/V1Beta/SearchTuningService.php and b/DiscoveryEngine/metadata/V1Beta/SearchTuningService.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/SiteSearchEngine.php b/DiscoveryEngine/metadata/V1Beta/SiteSearchEngine.php index 15139a4f786c..e47274b46105 100644 Binary files a/DiscoveryEngine/metadata/V1Beta/SiteSearchEngine.php and b/DiscoveryEngine/metadata/V1Beta/SiteSearchEngine.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/UserEvent.php b/DiscoveryEngine/metadata/V1Beta/UserEvent.php index f9e1caffff9e..b984df5cbb08 100644 Binary files a/DiscoveryEngine/metadata/V1Beta/UserEvent.php and b/DiscoveryEngine/metadata/V1Beta/UserEvent.php differ diff --git a/DiscoveryEngine/metadata/V1Beta/UserEventService.php b/DiscoveryEngine/metadata/V1Beta/UserEventService.php index 9bd6d82f7b2e..a248da787007 100644 Binary files a/DiscoveryEngine/metadata/V1Beta/UserEventService.php and b/DiscoveryEngine/metadata/V1Beta/UserEventService.php differ diff --git a/DiscoveryEngine/samples/V1/ControlServiceClient/create_control.php b/DiscoveryEngine/samples/V1/ControlServiceClient/create_control.php new file mode 100644 index 000000000000..f8040aef302b --- /dev/null +++ b/DiscoveryEngine/samples/V1/ControlServiceClient/create_control.php @@ -0,0 +1,105 @@ +setDisplayName($controlDisplayName) + ->setSolutionType($controlSolutionType); + $request = (new CreateControlRequest()) + ->setParent($formattedParent) + ->setControl($control) + ->setControlId($controlId); + + // Call the API and handle any network failures. + try { + /** @var Control $response */ + $response = $controlServiceClient->createControl($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ControlServiceClient::dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $controlDisplayName = '[DISPLAY_NAME]'; + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $controlId = '[CONTROL_ID]'; + + create_control_sample($formattedParent, $controlDisplayName, $controlSolutionType, $controlId); +} +// [END discoveryengine_v1_generated_ControlService_CreateControl_sync] diff --git a/DiscoveryEngine/samples/V1/ControlServiceClient/delete_control.php b/DiscoveryEngine/samples/V1/ControlServiceClient/delete_control.php new file mode 100644 index 000000000000..b2fe1eb0338f --- /dev/null +++ b/DiscoveryEngine/samples/V1/ControlServiceClient/delete_control.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $controlServiceClient->deleteControl($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ControlServiceClient::controlName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]', + '[CONTROL]' + ); + + delete_control_sample($formattedName); +} +// [END discoveryengine_v1_generated_ControlService_DeleteControl_sync] diff --git a/DiscoveryEngine/samples/V1/ControlServiceClient/get_control.php b/DiscoveryEngine/samples/V1/ControlServiceClient/get_control.php new file mode 100644 index 000000000000..1fd670cdf4bf --- /dev/null +++ b/DiscoveryEngine/samples/V1/ControlServiceClient/get_control.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Control $response */ + $response = $controlServiceClient->getControl($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ControlServiceClient::controlName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]', + '[CONTROL]' + ); + + get_control_sample($formattedName); +} +// [END discoveryengine_v1_generated_ControlService_GetControl_sync] diff --git a/DiscoveryEngine/samples/V1/ControlServiceClient/list_controls.php b/DiscoveryEngine/samples/V1/ControlServiceClient/list_controls.php new file mode 100644 index 000000000000..f76992244237 --- /dev/null +++ b/DiscoveryEngine/samples/V1/ControlServiceClient/list_controls.php @@ -0,0 +1,80 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $controlServiceClient->listControls($request); + + /** @var Control $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ControlServiceClient::dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + + list_controls_sample($formattedParent); +} +// [END discoveryengine_v1_generated_ControlService_ListControls_sync] diff --git a/DiscoveryEngine/samples/V1/ControlServiceClient/update_control.php b/DiscoveryEngine/samples/V1/ControlServiceClient/update_control.php new file mode 100644 index 000000000000..83411860c378 --- /dev/null +++ b/DiscoveryEngine/samples/V1/ControlServiceClient/update_control.php @@ -0,0 +1,86 @@ +setDisplayName($controlDisplayName) + ->setSolutionType($controlSolutionType); + $request = (new UpdateControlRequest()) + ->setControl($control); + + // Call the API and handle any network failures. + try { + /** @var Control $response */ + $response = $controlServiceClient->updateControl($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $controlDisplayName = '[DISPLAY_NAME]'; + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + + update_control_sample($controlDisplayName, $controlSolutionType); +} +// [END discoveryengine_v1_generated_ControlService_UpdateControl_sync] diff --git a/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/answer_query.php b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/answer_query.php new file mode 100644 index 000000000000..0ecbc54e367d --- /dev/null +++ b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/answer_query.php @@ -0,0 +1,84 @@ +setServingConfig($formattedServingConfig) + ->setQuery($query); + + // Call the API and handle any network failures. + try { + /** @var AnswerQueryResponse $response */ + $response = $conversationalSearchServiceClient->answerQuery($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedServingConfig = ConversationalSearchServiceClient::servingConfigName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]', + '[SERVING_CONFIG]' + ); + + answer_query_sample($formattedServingConfig); +} +// [END discoveryengine_v1_generated_ConversationalSearchService_AnswerQuery_sync] diff --git a/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/create_session.php b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/create_session.php new file mode 100644 index 000000000000..a50e3e1dccd7 --- /dev/null +++ b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/create_session.php @@ -0,0 +1,81 @@ +setParent($formattedParent) + ->setSession($session); + + // Call the API and handle any network failures. + try { + /** @var Session $response */ + $response = $conversationalSearchServiceClient->createSession($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ConversationalSearchServiceClient::dataStoreName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]' + ); + + create_session_sample($formattedParent); +} +// [END discoveryengine_v1_generated_ConversationalSearchService_CreateSession_sync] diff --git a/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/delete_session.php b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/delete_session.php new file mode 100644 index 000000000000..2c268c483569 --- /dev/null +++ b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/delete_session.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $conversationalSearchServiceClient->deleteSession($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ConversationalSearchServiceClient::sessionName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]', + '[SESSION]' + ); + + delete_session_sample($formattedName); +} +// [END discoveryengine_v1_generated_ConversationalSearchService_DeleteSession_sync] diff --git a/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/get_answer.php b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/get_answer.php new file mode 100644 index 000000000000..f38958ac3713 --- /dev/null +++ b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/get_answer.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Answer $response */ + $response = $conversationalSearchServiceClient->getAnswer($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ConversationalSearchServiceClient::answerName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]', + '[SESSION]', + '[ANSWER]' + ); + + get_answer_sample($formattedName); +} +// [END discoveryengine_v1_generated_ConversationalSearchService_GetAnswer_sync] diff --git a/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/get_session.php b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/get_session.php new file mode 100644 index 000000000000..814cf2271df2 --- /dev/null +++ b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/get_session.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Session $response */ + $response = $conversationalSearchServiceClient->getSession($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ConversationalSearchServiceClient::sessionName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]', + '[SESSION]' + ); + + get_session_sample($formattedName); +} +// [END discoveryengine_v1_generated_ConversationalSearchService_GetSession_sync] diff --git a/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/list_sessions.php b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/list_sessions.php new file mode 100644 index 000000000000..e46fe456fff6 --- /dev/null +++ b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/list_sessions.php @@ -0,0 +1,82 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $conversationalSearchServiceClient->listSessions($request); + + /** @var Session $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ConversationalSearchServiceClient::dataStoreName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]' + ); + + list_sessions_sample($formattedParent); +} +// [END discoveryengine_v1_generated_ConversationalSearchService_ListSessions_sync] diff --git a/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/update_session.php b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/update_session.php new file mode 100644 index 000000000000..39815db255b1 --- /dev/null +++ b/DiscoveryEngine/samples/V1/ConversationalSearchServiceClient/update_session.php @@ -0,0 +1,63 @@ +setSession($session); + + // Call the API and handle any network failures. + try { + /** @var Session $response */ + $response = $conversationalSearchServiceClient->updateSession($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} +// [END discoveryengine_v1_generated_ConversationalSearchService_UpdateSession_sync] diff --git a/DiscoveryEngine/samples/V1/DocumentServiceClient/create_document.php b/DiscoveryEngine/samples/V1/DocumentServiceClient/create_document.php index 370b946c1b49..410d9909f14a 100644 --- a/DiscoveryEngine/samples/V1/DocumentServiceClient/create_document.php +++ b/DiscoveryEngine/samples/V1/DocumentServiceClient/create_document.php @@ -35,7 +35,7 @@ * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`. Please see * {@see DocumentServiceClient::branchName()} for help formatting this field. * @param string $documentId The ID to use for the - * [Document][google.cloud.discoveryengine.v1.Document], which will become the + * [Document][google.cloud.discoveryengine.v1.Document], which becomes the * final component of the * [Document.name][google.cloud.discoveryengine.v1.Document.name]. * diff --git a/DiscoveryEngine/samples/V1/DocumentServiceClient/import_documents.php b/DiscoveryEngine/samples/V1/DocumentServiceClient/import_documents.php index 5956048420f9..a7f00b698e52 100644 --- a/DiscoveryEngine/samples/V1/DocumentServiceClient/import_documents.php +++ b/DiscoveryEngine/samples/V1/DocumentServiceClient/import_documents.php @@ -33,7 +33,7 @@ /** * Bulk import of multiple * [Document][google.cloud.discoveryengine.v1.Document]s. Request processing - * may be synchronous. Non-existing items will be created. + * may be synchronous. Non-existing items are created. * * Note: It is possible for a subset of the * [Document][google.cloud.discoveryengine.v1.Document]s to be successfully diff --git a/DiscoveryEngine/samples/V1/GroundedGenerationServiceClient/check_grounding.php b/DiscoveryEngine/samples/V1/GroundedGenerationServiceClient/check_grounding.php new file mode 100644 index 000000000000..0ce05015a4f6 --- /dev/null +++ b/DiscoveryEngine/samples/V1/GroundedGenerationServiceClient/check_grounding.php @@ -0,0 +1,76 @@ +setGroundingConfig($formattedGroundingConfig); + + // Call the API and handle any network failures. + try { + /** @var CheckGroundingResponse $response */ + $response = $groundedGenerationServiceClient->checkGrounding($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedGroundingConfig = GroundedGenerationServiceClient::groundingConfigName( + '[PROJECT]', + '[LOCATION]', + '[GROUNDING_CONFIG]' + ); + + check_grounding_sample($formattedGroundingConfig); +} +// [END discoveryengine_v1_generated_GroundedGenerationService_CheckGrounding_sync] diff --git a/DiscoveryEngine/samples/V1/ProjectServiceClient/provision_project.php b/DiscoveryEngine/samples/V1/ProjectServiceClient/provision_project.php new file mode 100644 index 000000000000..deda6d674ee8 --- /dev/null +++ b/DiscoveryEngine/samples/V1/ProjectServiceClient/provision_project.php @@ -0,0 +1,105 @@ +setName($formattedName) + ->setAcceptDataUseTerms($acceptDataUseTerms) + ->setDataUseTermsVersion($dataUseTermsVersion); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $projectServiceClient->provisionProject($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Project $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProjectServiceClient::projectName('[PROJECT]'); + $acceptDataUseTerms = false; + $dataUseTermsVersion = '[DATA_USE_TERMS_VERSION]'; + + provision_project_sample($formattedName, $acceptDataUseTerms, $dataUseTermsVersion); +} +// [END discoveryengine_v1_generated_ProjectService_ProvisionProject_sync] diff --git a/DiscoveryEngine/samples/V1/RankServiceClient/rank.php b/DiscoveryEngine/samples/V1/RankServiceClient/rank.php new file mode 100644 index 000000000000..c827628b944d --- /dev/null +++ b/DiscoveryEngine/samples/V1/RankServiceClient/rank.php @@ -0,0 +1,79 @@ +setRankingConfig($formattedRankingConfig) + ->setRecords($records); + + // Call the API and handle any network failures. + try { + /** @var RankResponse $response */ + $response = $rankServiceClient->rank($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedRankingConfig = RankServiceClient::rankingConfigName( + '[PROJECT]', + '[LOCATION]', + '[RANKING_CONFIG]' + ); + + rank_sample($formattedRankingConfig); +} +// [END discoveryengine_v1_generated_RankService_Rank_sync] diff --git a/DiscoveryEngine/samples/V1/RecommendationServiceClient/recommend.php b/DiscoveryEngine/samples/V1/RecommendationServiceClient/recommend.php index 0a7bee7714a3..c94fe9495c59 100644 --- a/DiscoveryEngine/samples/V1/RecommendationServiceClient/recommend.php +++ b/DiscoveryEngine/samples/V1/RecommendationServiceClient/recommend.php @@ -37,7 +37,7 @@ * `projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*` * * One default serving config is created along with your recommendation engine - * creation. The engine ID will be used as the ID of the default serving + * creation. The engine ID is used as the ID of the default serving * config. For example, for Engine * `projects/*/locations/global/collections/*/engines/my-engine`, you can use * `projects/*/locations/global/collections/*/engines/my-engine/servingConfigs/my-engine` diff --git a/DiscoveryEngine/samples/V1/SchemaServiceClient/create_schema.php b/DiscoveryEngine/samples/V1/SchemaServiceClient/create_schema.php index 7923a6496b81..591cbf4c3ac9 100644 --- a/DiscoveryEngine/samples/V1/SchemaServiceClient/create_schema.php +++ b/DiscoveryEngine/samples/V1/SchemaServiceClient/create_schema.php @@ -37,8 +37,8 @@ * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. Please see * {@see SchemaServiceClient::dataStoreName()} for help formatting this field. * @param string $schemaId The ID to use for the - * [Schema][google.cloud.discoveryengine.v1.Schema], which will become the - * final component of the + * [Schema][google.cloud.discoveryengine.v1.Schema], which becomes the final + * component of the * [Schema.name][google.cloud.discoveryengine.v1.Schema.name]. * * This field should conform to diff --git a/DiscoveryEngine/samples/V1/UserEventServiceClient/import_user_events.php b/DiscoveryEngine/samples/V1/UserEventServiceClient/import_user_events.php index 61007e1abc33..91dbf133d395 100644 --- a/DiscoveryEngine/samples/V1/UserEventServiceClient/import_user_events.php +++ b/DiscoveryEngine/samples/V1/UserEventServiceClient/import_user_events.php @@ -31,7 +31,7 @@ use Google\Rpc\Status; /** - * Bulk import of User events. Request processing might be + * Bulk import of user events. Request processing might be * synchronous. Events that already exist are skipped. * Use this method for backfilling historical user events. * diff --git a/DiscoveryEngine/samples/V1/UserEventServiceClient/write_user_event.php b/DiscoveryEngine/samples/V1/UserEventServiceClient/write_user_event.php index ba88a4876777..d31df0a2a1f4 100644 --- a/DiscoveryEngine/samples/V1/UserEventServiceClient/write_user_event.php +++ b/DiscoveryEngine/samples/V1/UserEventServiceClient/write_user_event.php @@ -31,8 +31,16 @@ /** * Writes a single user event. * - * @param string $formattedParent The parent DataStore resource name, such as - * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. Please see + * @param string $formattedParent The parent resource name. + * If the write user event action is applied in + * [DataStore][google.cloud.discoveryengine.v1.DataStore] level, the format + * is: + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. + * If the write user event action is applied in [Location][] level, for + * example, the event with + * [Document][google.cloud.discoveryengine.v1.Document] across multiple + * [DataStore][google.cloud.discoveryengine.v1.DataStore], the format is: + * `projects/{project}/locations/{location}`. Please see * {@see UserEventServiceClient::dataStoreName()} for help formatting this field. * @param string $userEventEventType User event type. Allowed values are: * diff --git a/DiscoveryEngine/samples/V1beta/ControlServiceClient/create_control.php b/DiscoveryEngine/samples/V1beta/ControlServiceClient/create_control.php new file mode 100644 index 000000000000..3fe97bee0d8a --- /dev/null +++ b/DiscoveryEngine/samples/V1beta/ControlServiceClient/create_control.php @@ -0,0 +1,105 @@ +setDisplayName($controlDisplayName) + ->setSolutionType($controlSolutionType); + $request = (new CreateControlRequest()) + ->setParent($formattedParent) + ->setControl($control) + ->setControlId($controlId); + + // Call the API and handle any network failures. + try { + /** @var Control $response */ + $response = $controlServiceClient->createControl($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ControlServiceClient::dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $controlDisplayName = '[DISPLAY_NAME]'; + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $controlId = '[CONTROL_ID]'; + + create_control_sample($formattedParent, $controlDisplayName, $controlSolutionType, $controlId); +} +// [END discoveryengine_v1beta_generated_ControlService_CreateControl_sync] diff --git a/DiscoveryEngine/samples/V1beta/ControlServiceClient/delete_control.php b/DiscoveryEngine/samples/V1beta/ControlServiceClient/delete_control.php new file mode 100644 index 000000000000..953459e4d83a --- /dev/null +++ b/DiscoveryEngine/samples/V1beta/ControlServiceClient/delete_control.php @@ -0,0 +1,78 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + $controlServiceClient->deleteControl($request); + printf('Call completed successfully.' . PHP_EOL); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ControlServiceClient::controlName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]', + '[CONTROL]' + ); + + delete_control_sample($formattedName); +} +// [END discoveryengine_v1beta_generated_ControlService_DeleteControl_sync] diff --git a/DiscoveryEngine/samples/V1beta/ControlServiceClient/get_control.php b/DiscoveryEngine/samples/V1beta/ControlServiceClient/get_control.php new file mode 100644 index 000000000000..5bdc58d7726f --- /dev/null +++ b/DiscoveryEngine/samples/V1beta/ControlServiceClient/get_control.php @@ -0,0 +1,77 @@ +setName($formattedName); + + // Call the API and handle any network failures. + try { + /** @var Control $response */ + $response = $controlServiceClient->getControl($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ControlServiceClient::controlName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]', + '[CONTROL]' + ); + + get_control_sample($formattedName); +} +// [END discoveryengine_v1beta_generated_ControlService_GetControl_sync] diff --git a/DiscoveryEngine/samples/V1beta/ControlServiceClient/list_controls.php b/DiscoveryEngine/samples/V1beta/ControlServiceClient/list_controls.php new file mode 100644 index 000000000000..ec2817819bc0 --- /dev/null +++ b/DiscoveryEngine/samples/V1beta/ControlServiceClient/list_controls.php @@ -0,0 +1,80 @@ +setParent($formattedParent); + + // Call the API and handle any network failures. + try { + /** @var PagedListResponse $response */ + $response = $controlServiceClient->listControls($request); + + /** @var Control $element */ + foreach ($response as $element) { + printf('Element data: %s' . PHP_EOL, $element->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedParent = ControlServiceClient::dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + + list_controls_sample($formattedParent); +} +// [END discoveryengine_v1beta_generated_ControlService_ListControls_sync] diff --git a/DiscoveryEngine/samples/V1beta/ControlServiceClient/update_control.php b/DiscoveryEngine/samples/V1beta/ControlServiceClient/update_control.php new file mode 100644 index 000000000000..3d2de009bf3e --- /dev/null +++ b/DiscoveryEngine/samples/V1beta/ControlServiceClient/update_control.php @@ -0,0 +1,86 @@ +setDisplayName($controlDisplayName) + ->setSolutionType($controlSolutionType); + $request = (new UpdateControlRequest()) + ->setControl($control); + + // Call the API and handle any network failures. + try { + /** @var Control $response */ + $response = $controlServiceClient->updateControl($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $controlDisplayName = '[DISPLAY_NAME]'; + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + + update_control_sample($controlDisplayName, $controlSolutionType); +} +// [END discoveryengine_v1beta_generated_ControlService_UpdateControl_sync] diff --git a/DiscoveryEngine/samples/V1beta/DocumentServiceClient/create_document.php b/DiscoveryEngine/samples/V1beta/DocumentServiceClient/create_document.php index a8e46998d290..58d799a693af 100644 --- a/DiscoveryEngine/samples/V1beta/DocumentServiceClient/create_document.php +++ b/DiscoveryEngine/samples/V1beta/DocumentServiceClient/create_document.php @@ -35,8 +35,8 @@ * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}`. Please see * {@see DocumentServiceClient::branchName()} for help formatting this field. * @param string $documentId The ID to use for the - * [Document][google.cloud.discoveryengine.v1beta.Document], which will become - * the final component of the + * [Document][google.cloud.discoveryengine.v1beta.Document], which becomes the + * final component of the * [Document.name][google.cloud.discoveryengine.v1beta.Document.name]. * * If the caller does not have permission to create the diff --git a/DiscoveryEngine/samples/V1beta/DocumentServiceClient/import_documents.php b/DiscoveryEngine/samples/V1beta/DocumentServiceClient/import_documents.php index a7878c9ca678..b21f21799c1c 100644 --- a/DiscoveryEngine/samples/V1beta/DocumentServiceClient/import_documents.php +++ b/DiscoveryEngine/samples/V1beta/DocumentServiceClient/import_documents.php @@ -33,7 +33,7 @@ /** * Bulk import of multiple * [Document][google.cloud.discoveryengine.v1beta.Document]s. Request - * processing may be synchronous. Non-existing items will be created. + * processing may be synchronous. Non-existing items are created. * * Note: It is possible for a subset of the * [Document][google.cloud.discoveryengine.v1beta.Document]s to be diff --git a/DiscoveryEngine/samples/V1beta/ProjectServiceClient/provision_project.php b/DiscoveryEngine/samples/V1beta/ProjectServiceClient/provision_project.php new file mode 100644 index 000000000000..39a6d52bb9d0 --- /dev/null +++ b/DiscoveryEngine/samples/V1beta/ProjectServiceClient/provision_project.php @@ -0,0 +1,105 @@ +setName($formattedName) + ->setAcceptDataUseTerms($acceptDataUseTerms) + ->setDataUseTermsVersion($dataUseTermsVersion); + + // Call the API and handle any network failures. + try { + /** @var OperationResponse $response */ + $response = $projectServiceClient->provisionProject($request); + $response->pollUntilComplete(); + + if ($response->operationSucceeded()) { + /** @var Project $result */ + $result = $response->getResult(); + printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString()); + } else { + /** @var Status $error */ + $error = $response->getError(); + printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString()); + } + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedName = ProjectServiceClient::projectName('[PROJECT]'); + $acceptDataUseTerms = false; + $dataUseTermsVersion = '[DATA_USE_TERMS_VERSION]'; + + provision_project_sample($formattedName, $acceptDataUseTerms, $dataUseTermsVersion); +} +// [END discoveryengine_v1beta_generated_ProjectService_ProvisionProject_sync] diff --git a/DiscoveryEngine/samples/V1beta/RecommendationServiceClient/recommend.php b/DiscoveryEngine/samples/V1beta/RecommendationServiceClient/recommend.php index 9d954083ab48..cfa16acd342a 100644 --- a/DiscoveryEngine/samples/V1beta/RecommendationServiceClient/recommend.php +++ b/DiscoveryEngine/samples/V1beta/RecommendationServiceClient/recommend.php @@ -38,7 +38,7 @@ * `projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*` * * One default serving config is created along with your recommendation engine - * creation. The engine ID will be used as the ID of the default serving + * creation. The engine ID is used as the ID of the default serving * config. For example, for Engine * `projects/*/locations/global/collections/*/engines/my-engine`, you can use * `projects/*/locations/global/collections/*/engines/my-engine/servingConfigs/my-engine` diff --git a/DiscoveryEngine/samples/V1beta/SchemaServiceClient/create_schema.php b/DiscoveryEngine/samples/V1beta/SchemaServiceClient/create_schema.php index 8b59f61f95ab..05e7e5bc25c7 100644 --- a/DiscoveryEngine/samples/V1beta/SchemaServiceClient/create_schema.php +++ b/DiscoveryEngine/samples/V1beta/SchemaServiceClient/create_schema.php @@ -37,7 +37,7 @@ * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. Please see * {@see SchemaServiceClient::dataStoreName()} for help formatting this field. * @param string $schemaId The ID to use for the - * [Schema][google.cloud.discoveryengine.v1beta.Schema], which will become the + * [Schema][google.cloud.discoveryengine.v1beta.Schema], which becomes the * final component of the * [Schema.name][google.cloud.discoveryengine.v1beta.Schema.name]. * diff --git a/DiscoveryEngine/samples/V1beta/SearchTuningServiceClient/list_custom_models.php b/DiscoveryEngine/samples/V1beta/SearchTuningServiceClient/list_custom_models.php new file mode 100644 index 000000000000..b9d1061cf6aa --- /dev/null +++ b/DiscoveryEngine/samples/V1beta/SearchTuningServiceClient/list_custom_models.php @@ -0,0 +1,78 @@ +setDataStore($formattedDataStore); + + // Call the API and handle any network failures. + try { + /** @var ListCustomModelsResponse $response */ + $response = $searchTuningServiceClient->listCustomModels($request); + printf('Response data: %s' . PHP_EOL, $response->serializeToJsonString()); + } catch (ApiException $ex) { + printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage()); + } +} + +/** + * Helper to execute the sample. + * + * This sample has been automatically generated and should be regarded as a code + * template only. It will require modifications to work: + * - It may require correct/in-range values for request initialization. + * - It may require specifying regional endpoints when creating the service client, + * please see the apiEndpoint client configuration option for more details. + */ +function callSample(): void +{ + $formattedDataStore = SearchTuningServiceClient::dataStoreName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]' + ); + + list_custom_models_sample($formattedDataStore); +} +// [END discoveryengine_v1beta_generated_SearchTuningService_ListCustomModels_sync] diff --git a/DiscoveryEngine/samples/V1beta/UserEventServiceClient/import_user_events.php b/DiscoveryEngine/samples/V1beta/UserEventServiceClient/import_user_events.php index e038496755cd..d12089a8d5ac 100644 --- a/DiscoveryEngine/samples/V1beta/UserEventServiceClient/import_user_events.php +++ b/DiscoveryEngine/samples/V1beta/UserEventServiceClient/import_user_events.php @@ -31,7 +31,7 @@ use Google\Rpc\Status; /** - * Bulk import of User events. Request processing might be + * Bulk import of user events. Request processing might be * synchronous. Events that already exist are skipped. * Use this method for backfilling historical user events. * diff --git a/DiscoveryEngine/samples/V1beta/UserEventServiceClient/write_user_event.php b/DiscoveryEngine/samples/V1beta/UserEventServiceClient/write_user_event.php index eaf89dfa96f2..a055f58cbc69 100644 --- a/DiscoveryEngine/samples/V1beta/UserEventServiceClient/write_user_event.php +++ b/DiscoveryEngine/samples/V1beta/UserEventServiceClient/write_user_event.php @@ -31,8 +31,16 @@ /** * Writes a single user event. * - * @param string $formattedParent The parent DataStore resource name, such as - * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. Please see + * @param string $formattedParent The parent resource name. + * If the write user event action is applied in + * [DataStore][google.cloud.discoveryengine.v1beta.DataStore] level, the + * format is: + * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. + * If the write user event action is applied in [Location][] level, for + * example, the event with + * [Document][google.cloud.discoveryengine.v1beta.Document] across multiple + * [DataStore][google.cloud.discoveryengine.v1beta.DataStore], the format is: + * `projects/{project}/locations/{location}`. Please see * {@see UserEventServiceClient::dataStoreName()} for help formatting this field. * @param string $userEventEventType User event type. Allowed values are: * diff --git a/DiscoveryEngine/src/V1/Answer.php b/DiscoveryEngine/src/V1/Answer.php new file mode 100644 index 000000000000..d015ad6155f4 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer.php @@ -0,0 +1,445 @@ +google.cloud.discoveryengine.v1.Answer + */ +class Answer extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. Fully qualified name + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * The state of the answer generation. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.State state = 2; + */ + protected $state = 0; + /** + * The textual answer. + * + * Generated from protobuf field string answer_text = 3; + */ + protected $answer_text = ''; + /** + * Citations. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Citation citations = 4; + */ + private $citations; + /** + * References. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Reference references = 5; + */ + private $references; + /** + * Suggested related questions. + * + * Generated from protobuf field repeated string related_questions = 6; + */ + private $related_questions; + /** + * Answer generation steps. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step steps = 7; + */ + private $steps; + /** + * Query understanding information. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo query_understanding_info = 10; + */ + protected $query_understanding_info = null; + /** + * Additional answer-skipped reasons. This provides the reason for ignored + * cases. If nothing is skipped, this field is not set. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.AnswerSkippedReason answer_skipped_reasons = 11; + */ + private $answer_skipped_reasons; + /** + * Output only. Answer creation timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. Answer completed timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $complete_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Immutable. Fully qualified name + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` + * @type int $state + * The state of the answer generation. + * @type string $answer_text + * The textual answer. + * @type array<\Google\Cloud\DiscoveryEngine\V1\Answer\Citation>|\Google\Protobuf\Internal\RepeatedField $citations + * Citations. + * @type array<\Google\Cloud\DiscoveryEngine\V1\Answer\Reference>|\Google\Protobuf\Internal\RepeatedField $references + * References. + * @type array|\Google\Protobuf\Internal\RepeatedField $related_questions + * Suggested related questions. + * @type array<\Google\Cloud\DiscoveryEngine\V1\Answer\Step>|\Google\Protobuf\Internal\RepeatedField $steps + * Answer generation steps. + * @type \Google\Cloud\DiscoveryEngine\V1\Answer\QueryUnderstandingInfo $query_understanding_info + * Query understanding information. + * @type array|\Google\Protobuf\Internal\RepeatedField $answer_skipped_reasons + * Additional answer-skipped reasons. This provides the reason for ignored + * cases. If nothing is skipped, this field is not set. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. Answer creation timestamp. + * @type \Google\Protobuf\Timestamp $complete_time + * Output only. Answer completed timestamp. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. Fully qualified name + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. Fully qualified name + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The state of the answer generation. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.State state = 2; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the answer generation. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.State state = 2; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DiscoveryEngine\V1\Answer\State::class); + $this->state = $var; + + return $this; + } + + /** + * The textual answer. + * + * Generated from protobuf field string answer_text = 3; + * @return string + */ + public function getAnswerText() + { + return $this->answer_text; + } + + /** + * The textual answer. + * + * Generated from protobuf field string answer_text = 3; + * @param string $var + * @return $this + */ + public function setAnswerText($var) + { + GPBUtil::checkString($var, True); + $this->answer_text = $var; + + return $this; + } + + /** + * Citations. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Citation citations = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCitations() + { + return $this->citations; + } + + /** + * Citations. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Citation citations = 4; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Answer\Citation>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCitations($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Answer\Citation::class); + $this->citations = $arr; + + return $this; + } + + /** + * References. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Reference references = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getReferences() + { + return $this->references; + } + + /** + * References. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Reference references = 5; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Answer\Reference>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setReferences($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Answer\Reference::class); + $this->references = $arr; + + return $this; + } + + /** + * Suggested related questions. + * + * Generated from protobuf field repeated string related_questions = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRelatedQuestions() + { + return $this->related_questions; + } + + /** + * Suggested related questions. + * + * Generated from protobuf field repeated string related_questions = 6; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRelatedQuestions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->related_questions = $arr; + + return $this; + } + + /** + * Answer generation steps. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step steps = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSteps() + { + return $this->steps; + } + + /** + * Answer generation steps. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step steps = 7; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Answer\Step>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSteps($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Answer\Step::class); + $this->steps = $arr; + + return $this; + } + + /** + * Query understanding information. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo query_understanding_info = 10; + * @return \Google\Cloud\DiscoveryEngine\V1\Answer\QueryUnderstandingInfo|null + */ + public function getQueryUnderstandingInfo() + { + return $this->query_understanding_info; + } + + public function hasQueryUnderstandingInfo() + { + return isset($this->query_understanding_info); + } + + public function clearQueryUnderstandingInfo() + { + unset($this->query_understanding_info); + } + + /** + * Query understanding information. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo query_understanding_info = 10; + * @param \Google\Cloud\DiscoveryEngine\V1\Answer\QueryUnderstandingInfo $var + * @return $this + */ + public function setQueryUnderstandingInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Answer\QueryUnderstandingInfo::class); + $this->query_understanding_info = $var; + + return $this; + } + + /** + * Additional answer-skipped reasons. This provides the reason for ignored + * cases. If nothing is skipped, this field is not set. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.AnswerSkippedReason answer_skipped_reasons = 11; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAnswerSkippedReasons() + { + return $this->answer_skipped_reasons; + } + + /** + * Additional answer-skipped reasons. This provides the reason for ignored + * cases. If nothing is skipped, this field is not set. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.AnswerSkippedReason answer_skipped_reasons = 11; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAnswerSkippedReasons($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\DiscoveryEngine\V1\Answer\AnswerSkippedReason::class); + $this->answer_skipped_reasons = $arr; + + return $this; + } + + /** + * Output only. Answer creation timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. Answer creation timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 8 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. Answer completed timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCompleteTime() + { + return $this->complete_time; + } + + public function hasCompleteTime() + { + return isset($this->complete_time); + } + + public function clearCompleteTime() + { + unset($this->complete_time); + } + + /** + * Output only. Answer completed timestamp. + * + * Generated from protobuf field .google.protobuf.Timestamp complete_time = 9 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCompleteTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->complete_time = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/Answer/AnswerSkippedReason.php b/DiscoveryEngine/src/V1/Answer/AnswerSkippedReason.php new file mode 100644 index 000000000000..2831e28d3e75 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/AnswerSkippedReason.php @@ -0,0 +1,79 @@ +google.cloud.discoveryengine.v1.Answer.AnswerSkippedReason + */ +class AnswerSkippedReason +{ + /** + * Default value. The answer skipped reason is not specified. + * + * Generated from protobuf enum ANSWER_SKIPPED_REASON_UNSPECIFIED = 0; + */ + const ANSWER_SKIPPED_REASON_UNSPECIFIED = 0; + /** + * The adversarial query ignored case. + * + * Generated from protobuf enum ADVERSARIAL_QUERY_IGNORED = 1; + */ + const ADVERSARIAL_QUERY_IGNORED = 1; + /** + * The non-answer seeking query ignored case. + * + * Generated from protobuf enum NON_ANSWER_SEEKING_QUERY_IGNORED = 2; + */ + const NON_ANSWER_SEEKING_QUERY_IGNORED = 2; + /** + * The out-of-domain query ignored case. + * Google skips the answer if there are no high-relevance search results. + * + * Generated from protobuf enum OUT_OF_DOMAIN_QUERY_IGNORED = 3; + */ + const OUT_OF_DOMAIN_QUERY_IGNORED = 3; + /** + * The potential policy violation case. + * Google skips the answer if there is a potential policy violation + * detected. This includes content that may be violent or toxic. + * + * Generated from protobuf enum POTENTIAL_POLICY_VIOLATION = 4; + */ + const POTENTIAL_POLICY_VIOLATION = 4; + + private static $valueToName = [ + self::ANSWER_SKIPPED_REASON_UNSPECIFIED => 'ANSWER_SKIPPED_REASON_UNSPECIFIED', + self::ADVERSARIAL_QUERY_IGNORED => 'ADVERSARIAL_QUERY_IGNORED', + self::NON_ANSWER_SEEKING_QUERY_IGNORED => 'NON_ANSWER_SEEKING_QUERY_IGNORED', + self::OUT_OF_DOMAIN_QUERY_IGNORED => 'OUT_OF_DOMAIN_QUERY_IGNORED', + self::POTENTIAL_POLICY_VIOLATION => 'POTENTIAL_POLICY_VIOLATION', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Citation.php b/DiscoveryEngine/src/V1/Answer/Citation.php new file mode 100644 index 000000000000..fd8913ea931c --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Citation.php @@ -0,0 +1,140 @@ +google.cloud.discoveryengine.v1.Answer.Citation + */ +class Citation extends \Google\Protobuf\Internal\Message +{ + /** + * Index indicates the start of the segment, measured in bytes (UTF-8 + * unicode). + * + * Generated from protobuf field int64 start_index = 1; + */ + protected $start_index = 0; + /** + * End of the attributed segment, exclusive. + * + * Generated from protobuf field int64 end_index = 2; + */ + protected $end_index = 0; + /** + * Citation sources for the attributed segment. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.CitationSource sources = 3; + */ + private $sources; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int|string $start_index + * Index indicates the start of the segment, measured in bytes (UTF-8 + * unicode). + * @type int|string $end_index + * End of the attributed segment, exclusive. + * @type array<\Google\Cloud\DiscoveryEngine\V1\Answer\CitationSource>|\Google\Protobuf\Internal\RepeatedField $sources + * Citation sources for the attributed segment. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Index indicates the start of the segment, measured in bytes (UTF-8 + * unicode). + * + * Generated from protobuf field int64 start_index = 1; + * @return int|string + */ + public function getStartIndex() + { + return $this->start_index; + } + + /** + * Index indicates the start of the segment, measured in bytes (UTF-8 + * unicode). + * + * Generated from protobuf field int64 start_index = 1; + * @param int|string $var + * @return $this + */ + public function setStartIndex($var) + { + GPBUtil::checkInt64($var); + $this->start_index = $var; + + return $this; + } + + /** + * End of the attributed segment, exclusive. + * + * Generated from protobuf field int64 end_index = 2; + * @return int|string + */ + public function getEndIndex() + { + return $this->end_index; + } + + /** + * End of the attributed segment, exclusive. + * + * Generated from protobuf field int64 end_index = 2; + * @param int|string $var + * @return $this + */ + public function setEndIndex($var) + { + GPBUtil::checkInt64($var); + $this->end_index = $var; + + return $this; + } + + /** + * Citation sources for the attributed segment. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.CitationSource sources = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSources() + { + return $this->sources; + } + + /** + * Citation sources for the attributed segment. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.CitationSource sources = 3; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Answer\CitationSource>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSources($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Answer\CitationSource::class); + $this->sources = $arr; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/CitationSource.php b/DiscoveryEngine/src/V1/Answer/CitationSource.php new file mode 100644 index 000000000000..b21003e4a139 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/CitationSource.php @@ -0,0 +1,68 @@ +google.cloud.discoveryengine.v1.Answer.CitationSource + */ +class CitationSource extends \Google\Protobuf\Internal\Message +{ + /** + * ID of the citation source. + * + * Generated from protobuf field string reference_id = 1; + */ + protected $reference_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $reference_id + * ID of the citation source. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * ID of the citation source. + * + * Generated from protobuf field string reference_id = 1; + * @return string + */ + public function getReferenceId() + { + return $this->reference_id; + } + + /** + * ID of the citation source. + * + * Generated from protobuf field string reference_id = 1; + * @param string $var + * @return $this + */ + public function setReferenceId($var) + { + GPBUtil::checkString($var, True); + $this->reference_id = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/QueryUnderstandingInfo.php b/DiscoveryEngine/src/V1/Answer/QueryUnderstandingInfo.php new file mode 100644 index 000000000000..435c1af240cd --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/QueryUnderstandingInfo.php @@ -0,0 +1,68 @@ +google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo + */ +class QueryUnderstandingInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Query classification information. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo query_classification_info = 1; + */ + private $query_classification_info; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DiscoveryEngine\V1\Answer\QueryUnderstandingInfo\QueryClassificationInfo>|\Google\Protobuf\Internal\RepeatedField $query_classification_info + * Query classification information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Query classification information. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo query_classification_info = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getQueryClassificationInfo() + { + return $this->query_classification_info; + } + + /** + * Query classification information. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo query_classification_info = 1; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Answer\QueryUnderstandingInfo\QueryClassificationInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setQueryClassificationInfo($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Answer\QueryUnderstandingInfo\QueryClassificationInfo::class); + $this->query_classification_info = $arr; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/QueryUnderstandingInfo/QueryClassificationInfo.php b/DiscoveryEngine/src/V1/Answer/QueryUnderstandingInfo/QueryClassificationInfo.php new file mode 100644 index 000000000000..126b078520f2 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/QueryUnderstandingInfo/QueryClassificationInfo.php @@ -0,0 +1,102 @@ +google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo + */ +class QueryClassificationInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Query classification type. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo.Type type = 1; + */ + protected $type = 0; + /** + * Classification output. + * + * Generated from protobuf field bool positive = 2; + */ + protected $positive = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $type + * Query classification type. + * @type bool $positive + * Classification output. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Query classification type. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo.Type type = 1; + * @return int + */ + public function getType() + { + return $this->type; + } + + /** + * Query classification type. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo.Type type = 1; + * @param int $var + * @return $this + */ + public function setType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DiscoveryEngine\V1\Answer\QueryUnderstandingInfo\QueryClassificationInfo\Type::class); + $this->type = $var; + + return $this; + } + + /** + * Classification output. + * + * Generated from protobuf field bool positive = 2; + * @return bool + */ + public function getPositive() + { + return $this->positive; + } + + /** + * Classification output. + * + * Generated from protobuf field bool positive = 2; + * @param bool $var + * @return $this + */ + public function setPositive($var) + { + GPBUtil::checkBool($var); + $this->positive = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/QueryUnderstandingInfo/QueryClassificationInfo/Type.php b/DiscoveryEngine/src/V1/Answer/QueryUnderstandingInfo/QueryClassificationInfo/Type.php new file mode 100644 index 000000000000..adc0e5e76096 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/QueryUnderstandingInfo/QueryClassificationInfo/Type.php @@ -0,0 +1,62 @@ +google.cloud.discoveryengine.v1.Answer.QueryUnderstandingInfo.QueryClassificationInfo.Type + */ +class Type +{ + /** + * Unspecified query classification type. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Adversarial query classification type. + * + * Generated from protobuf enum ADVERSARIAL_QUERY = 1; + */ + const ADVERSARIAL_QUERY = 1; + /** + * Non-answer-seeking query classification type. + * + * Generated from protobuf enum NON_ANSWER_SEEKING_QUERY = 2; + */ + const NON_ANSWER_SEEKING_QUERY = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::ADVERSARIAL_QUERY => 'ADVERSARIAL_QUERY', + self::NON_ANSWER_SEEKING_QUERY => 'NON_ANSWER_SEEKING_QUERY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Reference.php b/DiscoveryEngine/src/V1/Answer/Reference.php new file mode 100644 index 000000000000..97c9fbcaf51e --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Reference.php @@ -0,0 +1,109 @@ +google.cloud.discoveryengine.v1.Answer.Reference + */ +class Reference extends \Google\Protobuf\Internal\Message +{ + protected $content; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\UnstructuredDocumentInfo $unstructured_document_info + * Unstructured document information. + * @type \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\ChunkInfo $chunk_info + * Chunk information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Unstructured document information. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Reference.UnstructuredDocumentInfo unstructured_document_info = 1; + * @return \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\UnstructuredDocumentInfo|null + */ + public function getUnstructuredDocumentInfo() + { + return $this->readOneof(1); + } + + public function hasUnstructuredDocumentInfo() + { + return $this->hasOneof(1); + } + + /** + * Unstructured document information. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Reference.UnstructuredDocumentInfo unstructured_document_info = 1; + * @param \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\UnstructuredDocumentInfo $var + * @return $this + */ + public function setUnstructuredDocumentInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\UnstructuredDocumentInfo::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Chunk information. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Reference.ChunkInfo chunk_info = 2; + * @return \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\ChunkInfo|null + */ + public function getChunkInfo() + { + return $this->readOneof(2); + } + + public function hasChunkInfo() + { + return $this->hasOneof(2); + } + + /** + * Chunk information. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Reference.ChunkInfo chunk_info = 2; + * @param \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\ChunkInfo $var + * @return $this + */ + public function setChunkInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\ChunkInfo::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getContent() + { + return $this->whichOneof("content"); + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Reference/ChunkInfo.php b/DiscoveryEngine/src/V1/Answer/Reference/ChunkInfo.php new file mode 100644 index 000000000000..c9ff4ce71e61 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Reference/ChunkInfo.php @@ -0,0 +1,190 @@ +google.cloud.discoveryengine.v1.Answer.Reference.ChunkInfo + */ +class ChunkInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Chunk resource name. + * + * Generated from protobuf field string chunk = 1 [(.google.api.resource_reference) = { + */ + protected $chunk = ''; + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 2; + */ + protected $content = ''; + /** + * Relevance score. + * + * Generated from protobuf field optional float relevance_score = 3; + */ + protected $relevance_score = null; + /** + * Document metadata. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Reference.ChunkInfo.DocumentMetadata document_metadata = 4; + */ + protected $document_metadata = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $chunk + * Chunk resource name. + * @type string $content + * Chunk textual content. + * @type float $relevance_score + * Relevance score. + * @type \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\ChunkInfo\DocumentMetadata $document_metadata + * Document metadata. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Chunk resource name. + * + * Generated from protobuf field string chunk = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getChunk() + { + return $this->chunk; + } + + /** + * Chunk resource name. + * + * Generated from protobuf field string chunk = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setChunk($var) + { + GPBUtil::checkString($var, True); + $this->chunk = $var; + + return $this; + } + + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 2; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 2; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * Relevance score. + * + * Generated from protobuf field optional float relevance_score = 3; + * @return float + */ + public function getRelevanceScore() + { + return isset($this->relevance_score) ? $this->relevance_score : 0.0; + } + + public function hasRelevanceScore() + { + return isset($this->relevance_score); + } + + public function clearRelevanceScore() + { + unset($this->relevance_score); + } + + /** + * Relevance score. + * + * Generated from protobuf field optional float relevance_score = 3; + * @param float $var + * @return $this + */ + public function setRelevanceScore($var) + { + GPBUtil::checkFloat($var); + $this->relevance_score = $var; + + return $this; + } + + /** + * Document metadata. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Reference.ChunkInfo.DocumentMetadata document_metadata = 4; + * @return \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\ChunkInfo\DocumentMetadata|null + */ + public function getDocumentMetadata() + { + return $this->document_metadata; + } + + public function hasDocumentMetadata() + { + return isset($this->document_metadata); + } + + public function clearDocumentMetadata() + { + unset($this->document_metadata); + } + + /** + * Document metadata. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Reference.ChunkInfo.DocumentMetadata document_metadata = 4; + * @param \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\ChunkInfo\DocumentMetadata $var + * @return $this + */ + public function setDocumentMetadata($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\ChunkInfo\DocumentMetadata::class); + $this->document_metadata = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Reference/ChunkInfo/DocumentMetadata.php b/DiscoveryEngine/src/V1/Answer/Reference/ChunkInfo/DocumentMetadata.php new file mode 100644 index 000000000000..74e3fd5eb6b4 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Reference/ChunkInfo/DocumentMetadata.php @@ -0,0 +1,218 @@ +google.cloud.discoveryengine.v1.Answer.Reference.ChunkInfo.DocumentMetadata + */ +class DocumentMetadata extends \Google\Protobuf\Internal\Message +{ + /** + * Document resource name. + * + * Generated from protobuf field string document = 1 [(.google.api.resource_reference) = { + */ + protected $document = ''; + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + */ + protected $uri = ''; + /** + * Title. + * + * Generated from protobuf field string title = 3; + */ + protected $title = ''; + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 4; + */ + protected $page_identifier = ''; + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + */ + protected $struct_data = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $document + * Document resource name. + * @type string $uri + * URI for the document. + * @type string $title + * Title. + * @type string $page_identifier + * Page identifier. + * @type \Google\Protobuf\Struct $struct_data + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Document resource name. + * + * Generated from protobuf field string document = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getDocument() + { + return $this->document; + } + + /** + * Document resource name. + * + * Generated from protobuf field string document = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkString($var, True); + $this->document = $var; + + return $this; + } + + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Title. + * + * Generated from protobuf field string title = 3; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Title. + * + * Generated from protobuf field string title = 3; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 4; + * @return string + */ + public function getPageIdentifier() + { + return $this->page_identifier; + } + + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 4; + * @param string $var + * @return $this + */ + public function setPageIdentifier($var) + { + GPBUtil::checkString($var, True); + $this->page_identifier = $var; + + return $this; + } + + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + * @return \Google\Protobuf\Struct|null + */ + public function getStructData() + { + return $this->struct_data; + } + + public function hasStructData() + { + return isset($this->struct_data); + } + + public function clearStructData() + { + unset($this->struct_data); + } + + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setStructData($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->struct_data = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Reference/UnstructuredDocumentInfo.php b/DiscoveryEngine/src/V1/Answer/Reference/UnstructuredDocumentInfo.php new file mode 100644 index 000000000000..7fb3b4c15587 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Reference/UnstructuredDocumentInfo.php @@ -0,0 +1,218 @@ +google.cloud.discoveryengine.v1.Answer.Reference.UnstructuredDocumentInfo + */ +class UnstructuredDocumentInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Document resource name. + * + * Generated from protobuf field string document = 1 [(.google.api.resource_reference) = { + */ + protected $document = ''; + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + */ + protected $uri = ''; + /** + * Title. + * + * Generated from protobuf field string title = 3; + */ + protected $title = ''; + /** + * List of cited chunk contents derived from document content. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Reference.UnstructuredDocumentInfo.ChunkContent chunk_contents = 4; + */ + private $chunk_contents; + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + */ + protected $struct_data = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $document + * Document resource name. + * @type string $uri + * URI for the document. + * @type string $title + * Title. + * @type array<\Google\Cloud\DiscoveryEngine\V1\Answer\Reference\UnstructuredDocumentInfo\ChunkContent>|\Google\Protobuf\Internal\RepeatedField $chunk_contents + * List of cited chunk contents derived from document content. + * @type \Google\Protobuf\Struct $struct_data + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Document resource name. + * + * Generated from protobuf field string document = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getDocument() + { + return $this->document; + } + + /** + * Document resource name. + * + * Generated from protobuf field string document = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkString($var, True); + $this->document = $var; + + return $this; + } + + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Title. + * + * Generated from protobuf field string title = 3; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Title. + * + * Generated from protobuf field string title = 3; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * List of cited chunk contents derived from document content. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Reference.UnstructuredDocumentInfo.ChunkContent chunk_contents = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getChunkContents() + { + return $this->chunk_contents; + } + + /** + * List of cited chunk contents derived from document content. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Reference.UnstructuredDocumentInfo.ChunkContent chunk_contents = 4; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Answer\Reference\UnstructuredDocumentInfo\ChunkContent>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setChunkContents($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Answer\Reference\UnstructuredDocumentInfo\ChunkContent::class); + $this->chunk_contents = $arr; + + return $this; + } + + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + * @return \Google\Protobuf\Struct|null + */ + public function getStructData() + { + return $this->struct_data; + } + + public function hasStructData() + { + return isset($this->struct_data); + } + + public function clearStructData() + { + unset($this->struct_data); + } + + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setStructData($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->struct_data = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Reference/UnstructuredDocumentInfo/ChunkContent.php b/DiscoveryEngine/src/V1/Answer/Reference/UnstructuredDocumentInfo/ChunkContent.php new file mode 100644 index 000000000000..7c751ed1c5e8 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Reference/UnstructuredDocumentInfo/ChunkContent.php @@ -0,0 +1,102 @@ +google.cloud.discoveryengine.v1.Answer.Reference.UnstructuredDocumentInfo.ChunkContent + */ +class ChunkContent extends \Google\Protobuf\Internal\Message +{ + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 1; + */ + protected $content = ''; + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 2; + */ + protected $page_identifier = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $content + * Chunk textual content. + * @type string $page_identifier + * Page identifier. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 1; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 1; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 2; + * @return string + */ + public function getPageIdentifier() + { + return $this->page_identifier; + } + + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 2; + * @param string $var + * @return $this + */ + public function setPageIdentifier($var) + { + GPBUtil::checkString($var, True); + $this->page_identifier = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/State.php b/DiscoveryEngine/src/V1/Answer/State.php new file mode 100644 index 000000000000..6ca566b78136 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/State.php @@ -0,0 +1,69 @@ +google.cloud.discoveryengine.v1.Answer.State + */ +class State +{ + /** + * Unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Answer generation is currently in progress. + * + * Generated from protobuf enum IN_PROGRESS = 1; + */ + const IN_PROGRESS = 1; + /** + * Answer generation currently failed. + * + * Generated from protobuf enum FAILED = 2; + */ + const FAILED = 2; + /** + * Answer generation has succeeded. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::IN_PROGRESS => 'IN_PROGRESS', + self::FAILED => 'FAILED', + self::SUCCEEDED => 'SUCCEEDED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Step.php b/DiscoveryEngine/src/V1/Answer/Step.php new file mode 100644 index 000000000000..68634c39897f --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Step.php @@ -0,0 +1,170 @@ +google.cloud.discoveryengine.v1.Answer.Step + */ +class Step extends \Google\Protobuf\Internal\Message +{ + /** + * The state of the step. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Step.State state = 1; + */ + protected $state = 0; + /** + * The description of the step. + * + * Generated from protobuf field string description = 2; + */ + protected $description = ''; + /** + * The thought of the step. + * + * Generated from protobuf field string thought = 3; + */ + protected $thought = ''; + /** + * Actions. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action actions = 4; + */ + private $actions; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $state + * The state of the step. + * @type string $description + * The description of the step. + * @type string $thought + * The thought of the step. + * @type array<\Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action>|\Google\Protobuf\Internal\RepeatedField $actions + * Actions. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * The state of the step. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Step.State state = 1; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the step. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Step.State state = 1; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DiscoveryEngine\V1\Answer\Step\State::class); + $this->state = $var; + + return $this; + } + + /** + * The description of the step. + * + * Generated from protobuf field string description = 2; + * @return string + */ + public function getDescription() + { + return $this->description; + } + + /** + * The description of the step. + * + * Generated from protobuf field string description = 2; + * @param string $var + * @return $this + */ + public function setDescription($var) + { + GPBUtil::checkString($var, True); + $this->description = $var; + + return $this; + } + + /** + * The thought of the step. + * + * Generated from protobuf field string thought = 3; + * @return string + */ + public function getThought() + { + return $this->thought; + } + + /** + * The thought of the step. + * + * Generated from protobuf field string thought = 3; + * @param string $var + * @return $this + */ + public function setThought($var) + { + GPBUtil::checkString($var, True); + $this->thought = $var; + + return $this; + } + + /** + * Actions. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action actions = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getActions() + { + return $this->actions; + } + + /** + * Actions. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action actions = 4; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setActions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action::class); + $this->actions = $arr; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Step/Action.php b/DiscoveryEngine/src/V1/Answer/Step/Action.php new file mode 100644 index 000000000000..b5900efabf9e --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Step/Action.php @@ -0,0 +1,120 @@ +google.cloud.discoveryengine.v1.Answer.Step.Action + */ +class Action extends \Google\Protobuf\Internal\Message +{ + /** + * Observation. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation observation = 3; + */ + protected $observation = null; + protected $action; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\SearchAction $search_action + * Search action. + * @type \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation $observation + * Observation. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Search action. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Step.Action.SearchAction search_action = 2; + * @return \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\SearchAction|null + */ + public function getSearchAction() + { + return $this->readOneof(2); + } + + public function hasSearchAction() + { + return $this->hasOneof(2); + } + + /** + * Search action. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Step.Action.SearchAction search_action = 2; + * @param \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\SearchAction $var + * @return $this + */ + public function setSearchAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\SearchAction::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Observation. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation observation = 3; + * @return \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation|null + */ + public function getObservation() + { + return $this->observation; + } + + public function hasObservation() + { + return isset($this->observation); + } + + public function clearObservation() + { + unset($this->observation); + } + + /** + * Observation. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation observation = 3; + * @param \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation $var + * @return $this + */ + public function setObservation($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation::class); + $this->observation = $var; + + return $this; + } + + /** + * @return string + */ + public function getAction() + { + return $this->whichOneof("action"); + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Step/Action/Observation.php b/DiscoveryEngine/src/V1/Answer/Step/Action/Observation.php new file mode 100644 index 000000000000..43e13119e0a3 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Step/Action/Observation.php @@ -0,0 +1,72 @@ +google.cloud.discoveryengine.v1.Answer.Step.Action.Observation + */ +class Observation extends \Google\Protobuf\Internal\Message +{ + /** + * Search results observed by the search action, it can be snippets info + * or chunk info, depending on the citation type set by the user. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult search_results = 2; + */ + private $search_results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation\SearchResult>|\Google\Protobuf\Internal\RepeatedField $search_results + * Search results observed by the search action, it can be snippets info + * or chunk info, depending on the citation type set by the user. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Search results observed by the search action, it can be snippets info + * or chunk info, depending on the citation type set by the user. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult search_results = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSearchResults() + { + return $this->search_results; + } + + /** + * Search results observed by the search action, it can be snippets info + * or chunk info, depending on the citation type set by the user. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult search_results = 2; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation\SearchResult>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSearchResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation\SearchResult::class); + $this->search_results = $arr; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Step/Action/Observation/SearchResult.php b/DiscoveryEngine/src/V1/Answer/Step/Action/Observation/SearchResult.php new file mode 100644 index 000000000000..7244593e987a --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Step/Action/Observation/SearchResult.php @@ -0,0 +1,210 @@ +google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult + */ +class SearchResult extends \Google\Protobuf\Internal\Message +{ + /** + * Document resource name. + * + * Generated from protobuf field string document = 1; + */ + protected $document = ''; + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + */ + protected $uri = ''; + /** + * Title. + * + * Generated from protobuf field string title = 3; + */ + protected $title = ''; + /** + * If citation_type is DOCUMENT_LEVEL_CITATION, populate document + * level snippets. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.SnippetInfo snippet_info = 4; + */ + private $snippet_info; + /** + * If citation_type is CHUNK_LEVEL_CITATION and chunk mode is on, + * populate chunk info. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.ChunkInfo chunk_info = 5; + */ + private $chunk_info; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $document + * Document resource name. + * @type string $uri + * URI for the document. + * @type string $title + * Title. + * @type array<\Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation\SearchResult\SnippetInfo>|\Google\Protobuf\Internal\RepeatedField $snippet_info + * If citation_type is DOCUMENT_LEVEL_CITATION, populate document + * level snippets. + * @type array<\Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation\SearchResult\ChunkInfo>|\Google\Protobuf\Internal\RepeatedField $chunk_info + * If citation_type is CHUNK_LEVEL_CITATION and chunk mode is on, + * populate chunk info. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Document resource name. + * + * Generated from protobuf field string document = 1; + * @return string + */ + public function getDocument() + { + return $this->document; + } + + /** + * Document resource name. + * + * Generated from protobuf field string document = 1; + * @param string $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkString($var, True); + $this->document = $var; + + return $this; + } + + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Title. + * + * Generated from protobuf field string title = 3; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Title. + * + * Generated from protobuf field string title = 3; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * If citation_type is DOCUMENT_LEVEL_CITATION, populate document + * level snippets. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.SnippetInfo snippet_info = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSnippetInfo() + { + return $this->snippet_info; + } + + /** + * If citation_type is DOCUMENT_LEVEL_CITATION, populate document + * level snippets. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.SnippetInfo snippet_info = 4; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation\SearchResult\SnippetInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSnippetInfo($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation\SearchResult\SnippetInfo::class); + $this->snippet_info = $arr; + + return $this; + } + + /** + * If citation_type is CHUNK_LEVEL_CITATION and chunk mode is on, + * populate chunk info. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.ChunkInfo chunk_info = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getChunkInfo() + { + return $this->chunk_info; + } + + /** + * If citation_type is CHUNK_LEVEL_CITATION and chunk mode is on, + * populate chunk info. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.ChunkInfo chunk_info = 5; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation\SearchResult\ChunkInfo>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setChunkInfo($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Answer\Step\Action\Observation\SearchResult\ChunkInfo::class); + $this->chunk_info = $arr; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Step/Action/Observation/SearchResult/ChunkInfo.php b/DiscoveryEngine/src/V1/Answer/Step/Action/Observation/SearchResult/ChunkInfo.php new file mode 100644 index 000000000000..ee87db5479d8 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Step/Action/Observation/SearchResult/ChunkInfo.php @@ -0,0 +1,146 @@ +google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.ChunkInfo + */ +class ChunkInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Chunk resource name. + * + * Generated from protobuf field string chunk = 1; + */ + protected $chunk = ''; + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 2; + */ + protected $content = ''; + /** + * Relevance score. + * + * Generated from protobuf field optional float relevance_score = 3; + */ + protected $relevance_score = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $chunk + * Chunk resource name. + * @type string $content + * Chunk textual content. + * @type float $relevance_score + * Relevance score. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Chunk resource name. + * + * Generated from protobuf field string chunk = 1; + * @return string + */ + public function getChunk() + { + return $this->chunk; + } + + /** + * Chunk resource name. + * + * Generated from protobuf field string chunk = 1; + * @param string $var + * @return $this + */ + public function setChunk($var) + { + GPBUtil::checkString($var, True); + $this->chunk = $var; + + return $this; + } + + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 2; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 2; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * Relevance score. + * + * Generated from protobuf field optional float relevance_score = 3; + * @return float + */ + public function getRelevanceScore() + { + return isset($this->relevance_score) ? $this->relevance_score : 0.0; + } + + public function hasRelevanceScore() + { + return isset($this->relevance_score); + } + + public function clearRelevanceScore() + { + unset($this->relevance_score); + } + + /** + * Relevance score. + * + * Generated from protobuf field optional float relevance_score = 3; + * @param float $var + * @return $this + */ + public function setRelevanceScore($var) + { + GPBUtil::checkFloat($var); + $this->relevance_score = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Step/Action/Observation/SearchResult/SnippetInfo.php b/DiscoveryEngine/src/V1/Answer/Step/Action/Observation/SearchResult/SnippetInfo.php new file mode 100644 index 000000000000..3acbbb0f66c1 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Step/Action/Observation/SearchResult/SnippetInfo.php @@ -0,0 +1,102 @@ +google.cloud.discoveryengine.v1.Answer.Step.Action.Observation.SearchResult.SnippetInfo + */ +class SnippetInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Snippet content. + * + * Generated from protobuf field string snippet = 1; + */ + protected $snippet = ''; + /** + * Status of the snippet defined by the search team. + * + * Generated from protobuf field string snippet_status = 2; + */ + protected $snippet_status = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $snippet + * Snippet content. + * @type string $snippet_status + * Status of the snippet defined by the search team. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * Snippet content. + * + * Generated from protobuf field string snippet = 1; + * @return string + */ + public function getSnippet() + { + return $this->snippet; + } + + /** + * Snippet content. + * + * Generated from protobuf field string snippet = 1; + * @param string $var + * @return $this + */ + public function setSnippet($var) + { + GPBUtil::checkString($var, True); + $this->snippet = $var; + + return $this; + } + + /** + * Status of the snippet defined by the search team. + * + * Generated from protobuf field string snippet_status = 2; + * @return string + */ + public function getSnippetStatus() + { + return $this->snippet_status; + } + + /** + * Status of the snippet defined by the search team. + * + * Generated from protobuf field string snippet_status = 2; + * @param string $var + * @return $this + */ + public function setSnippetStatus($var) + { + GPBUtil::checkString($var, True); + $this->snippet_status = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Step/Action/SearchAction.php b/DiscoveryEngine/src/V1/Answer/Step/Action/SearchAction.php new file mode 100644 index 000000000000..d3af5899c355 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Step/Action/SearchAction.php @@ -0,0 +1,68 @@ +google.cloud.discoveryengine.v1.Answer.Step.Action.SearchAction + */ +class SearchAction extends \Google\Protobuf\Internal\Message +{ + /** + * The query to search. + * + * Generated from protobuf field string query = 1; + */ + protected $query = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $query + * The query to search. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Answer::initOnce(); + parent::__construct($data); + } + + /** + * The query to search. + * + * Generated from protobuf field string query = 1; + * @return string + */ + public function getQuery() + { + return $this->query; + } + + /** + * The query to search. + * + * Generated from protobuf field string query = 1; + * @param string $var + * @return $this + */ + public function setQuery($var) + { + GPBUtil::checkString($var, True); + $this->query = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Answer/Step/State.php b/DiscoveryEngine/src/V1/Answer/Step/State.php new file mode 100644 index 000000000000..7cf4f0e088e1 --- /dev/null +++ b/DiscoveryEngine/src/V1/Answer/Step/State.php @@ -0,0 +1,69 @@ +google.cloud.discoveryengine.v1.Answer.Step.State + */ +class State +{ + /** + * Unknown. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * Step is currently in progress. + * + * Generated from protobuf enum IN_PROGRESS = 1; + */ + const IN_PROGRESS = 1; + /** + * Step currently failed. + * + * Generated from protobuf enum FAILED = 2; + */ + const FAILED = 2; + /** + * Step has succeeded. + * + * Generated from protobuf enum SUCCEEDED = 3; + */ + const SUCCEEDED = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::IN_PROGRESS => 'IN_PROGRESS', + self::FAILED => 'FAILED', + self::SUCCEEDED => 'SUCCEEDED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest.php b/DiscoveryEngine/src/V1/AnswerQueryRequest.php new file mode 100644 index 000000000000..fb0beb327b52 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest.php @@ -0,0 +1,519 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest + */ +class AnswerQueryRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Search serving config, such as + * `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`, + * or + * `projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config`. + * This field is used to identify the serving configuration name, set + * of models used to make the search. + * + * Generated from protobuf field string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $serving_config = ''; + /** + * Required. Current user query. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Query query = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $query = null; + /** + * The session resource name. Not required. + * When session field is not set, the API is in sessionless mode. + * We support auto session mode: users can use the wildcard symbol `-` as + * session ID. A new ID will be automatically generated and assigned. + * + * Generated from protobuf field string session = 3 [(.google.api.resource_reference) = { + */ + protected $session = ''; + /** + * Model specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SafetySpec safety_spec = 4; + */ + protected $safety_spec = null; + /** + * Related questions specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.RelatedQuestionsSpec related_questions_spec = 5; + */ + protected $related_questions_spec = null; + /** + * Answer generation specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec answer_generation_spec = 7; + */ + protected $answer_generation_spec = null; + /** + * Search specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec search_spec = 8; + */ + protected $search_spec = null; + /** + * Query understanding specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec query_understanding_spec = 9; + */ + protected $query_understanding_spec = null; + /** + * Asynchronous mode control. + * If enabled, the response will be returned with answer/session resource + * name without final answer. The API users need to do the polling to get + * the latest status of answer/session by calling + * [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1.ConversationalSearchService.GetAnswer] + * or + * [ConversationalSearchService.GetSession][google.cloud.discoveryengine.v1.ConversationalSearchService.GetSession] + * method. + * + * Generated from protobuf field bool asynchronous_mode = 10; + */ + protected $asynchronous_mode = false; + /** + * A unique identifier for tracking visitors. For example, this could be + * implemented with an HTTP cookie, which should be able to uniquely identify + * a visitor on a single device. This unique identifier should not change if + * the visitor logs in or out of the website. + * This field should NOT have a fixed value such as `unknown_visitor`. + * The field must be a UTF-8 encoded string with a length limit of 128 + * characters. Otherwise, an `INVALID_ARGUMENT` error is returned. + * + * Generated from protobuf field string user_pseudo_id = 12; + */ + protected $user_pseudo_id = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $serving_config + * Required. The resource name of the Search serving config, such as + * `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`, + * or + * `projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config`. + * This field is used to identify the serving configuration name, set + * of models used to make the search. + * @type \Google\Cloud\DiscoveryEngine\V1\Query $query + * Required. Current user query. + * @type string $session + * The session resource name. Not required. + * When session field is not set, the API is in sessionless mode. + * We support auto session mode: users can use the wildcard symbol `-` as + * session ID. A new ID will be automatically generated and assigned. + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SafetySpec $safety_spec + * Model specification. + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\RelatedQuestionsSpec $related_questions_spec + * Related questions specification. + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec $answer_generation_spec + * Answer generation specification. + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec $search_spec + * Search specification. + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec $query_understanding_spec + * Query understanding specification. + * @type bool $asynchronous_mode + * Asynchronous mode control. + * If enabled, the response will be returned with answer/session resource + * name without final answer. The API users need to do the polling to get + * the latest status of answer/session by calling + * [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1.ConversationalSearchService.GetAnswer] + * or + * [ConversationalSearchService.GetSession][google.cloud.discoveryengine.v1.ConversationalSearchService.GetSession] + * method. + * @type string $user_pseudo_id + * A unique identifier for tracking visitors. For example, this could be + * implemented with an HTTP cookie, which should be able to uniquely identify + * a visitor on a single device. This unique identifier should not change if + * the visitor logs in or out of the website. + * This field should NOT have a fixed value such as `unknown_visitor`. + * The field must be a UTF-8 encoded string with a length limit of 128 + * characters. Otherwise, an `INVALID_ARGUMENT` error is returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Search serving config, such as + * `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`, + * or + * `projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config`. + * This field is used to identify the serving configuration name, set + * of models used to make the search. + * + * Generated from protobuf field string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getServingConfig() + { + return $this->serving_config; + } + + /** + * Required. The resource name of the Search serving config, such as + * `projects/*/locations/global/collections/default_collection/engines/*/servingConfigs/default_serving_config`, + * or + * `projects/*/locations/global/collections/default_collection/dataStores/*/servingConfigs/default_serving_config`. + * This field is used to identify the serving configuration name, set + * of models used to make the search. + * + * Generated from protobuf field string serving_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setServingConfig($var) + { + GPBUtil::checkString($var, True); + $this->serving_config = $var; + + return $this; + } + + /** + * Required. Current user query. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Query query = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\DiscoveryEngine\V1\Query|null + */ + public function getQuery() + { + return $this->query; + } + + public function hasQuery() + { + return isset($this->query); + } + + public function clearQuery() + { + unset($this->query); + } + + /** + * Required. Current user query. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Query query = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\DiscoveryEngine\V1\Query $var + * @return $this + */ + public function setQuery($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Query::class); + $this->query = $var; + + return $this; + } + + /** + * The session resource name. Not required. + * When session field is not set, the API is in sessionless mode. + * We support auto session mode: users can use the wildcard symbol `-` as + * session ID. A new ID will be automatically generated and assigned. + * + * Generated from protobuf field string session = 3 [(.google.api.resource_reference) = { + * @return string + */ + public function getSession() + { + return $this->session; + } + + /** + * The session resource name. Not required. + * When session field is not set, the API is in sessionless mode. + * We support auto session mode: users can use the wildcard symbol `-` as + * session ID. A new ID will be automatically generated and assigned. + * + * Generated from protobuf field string session = 3 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkString($var, True); + $this->session = $var; + + return $this; + } + + /** + * Model specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SafetySpec safety_spec = 4; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SafetySpec|null + */ + public function getSafetySpec() + { + return $this->safety_spec; + } + + public function hasSafetySpec() + { + return isset($this->safety_spec); + } + + public function clearSafetySpec() + { + unset($this->safety_spec); + } + + /** + * Model specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SafetySpec safety_spec = 4; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SafetySpec $var + * @return $this + */ + public function setSafetySpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SafetySpec::class); + $this->safety_spec = $var; + + return $this; + } + + /** + * Related questions specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.RelatedQuestionsSpec related_questions_spec = 5; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\RelatedQuestionsSpec|null + */ + public function getRelatedQuestionsSpec() + { + return $this->related_questions_spec; + } + + public function hasRelatedQuestionsSpec() + { + return isset($this->related_questions_spec); + } + + public function clearRelatedQuestionsSpec() + { + unset($this->related_questions_spec); + } + + /** + * Related questions specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.RelatedQuestionsSpec related_questions_spec = 5; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\RelatedQuestionsSpec $var + * @return $this + */ + public function setRelatedQuestionsSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\RelatedQuestionsSpec::class); + $this->related_questions_spec = $var; + + return $this; + } + + /** + * Answer generation specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec answer_generation_spec = 7; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec|null + */ + public function getAnswerGenerationSpec() + { + return $this->answer_generation_spec; + } + + public function hasAnswerGenerationSpec() + { + return isset($this->answer_generation_spec); + } + + public function clearAnswerGenerationSpec() + { + unset($this->answer_generation_spec); + } + + /** + * Answer generation specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec answer_generation_spec = 7; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec $var + * @return $this + */ + public function setAnswerGenerationSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec::class); + $this->answer_generation_spec = $var; + + return $this; + } + + /** + * Search specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec search_spec = 8; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec|null + */ + public function getSearchSpec() + { + return $this->search_spec; + } + + public function hasSearchSpec() + { + return isset($this->search_spec); + } + + public function clearSearchSpec() + { + unset($this->search_spec); + } + + /** + * Search specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec search_spec = 8; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec $var + * @return $this + */ + public function setSearchSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec::class); + $this->search_spec = $var; + + return $this; + } + + /** + * Query understanding specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec query_understanding_spec = 9; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec|null + */ + public function getQueryUnderstandingSpec() + { + return $this->query_understanding_spec; + } + + public function hasQueryUnderstandingSpec() + { + return isset($this->query_understanding_spec); + } + + public function clearQueryUnderstandingSpec() + { + unset($this->query_understanding_spec); + } + + /** + * Query understanding specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec query_understanding_spec = 9; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec $var + * @return $this + */ + public function setQueryUnderstandingSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec::class); + $this->query_understanding_spec = $var; + + return $this; + } + + /** + * Asynchronous mode control. + * If enabled, the response will be returned with answer/session resource + * name without final answer. The API users need to do the polling to get + * the latest status of answer/session by calling + * [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1.ConversationalSearchService.GetAnswer] + * or + * [ConversationalSearchService.GetSession][google.cloud.discoveryengine.v1.ConversationalSearchService.GetSession] + * method. + * + * Generated from protobuf field bool asynchronous_mode = 10; + * @return bool + */ + public function getAsynchronousMode() + { + return $this->asynchronous_mode; + } + + /** + * Asynchronous mode control. + * If enabled, the response will be returned with answer/session resource + * name without final answer. The API users need to do the polling to get + * the latest status of answer/session by calling + * [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1.ConversationalSearchService.GetAnswer] + * or + * [ConversationalSearchService.GetSession][google.cloud.discoveryengine.v1.ConversationalSearchService.GetSession] + * method. + * + * Generated from protobuf field bool asynchronous_mode = 10; + * @param bool $var + * @return $this + */ + public function setAsynchronousMode($var) + { + GPBUtil::checkBool($var); + $this->asynchronous_mode = $var; + + return $this; + } + + /** + * A unique identifier for tracking visitors. For example, this could be + * implemented with an HTTP cookie, which should be able to uniquely identify + * a visitor on a single device. This unique identifier should not change if + * the visitor logs in or out of the website. + * This field should NOT have a fixed value such as `unknown_visitor`. + * The field must be a UTF-8 encoded string with a length limit of 128 + * characters. Otherwise, an `INVALID_ARGUMENT` error is returned. + * + * Generated from protobuf field string user_pseudo_id = 12; + * @return string + */ + public function getUserPseudoId() + { + return $this->user_pseudo_id; + } + + /** + * A unique identifier for tracking visitors. For example, this could be + * implemented with an HTTP cookie, which should be able to uniquely identify + * a visitor on a single device. This unique identifier should not change if + * the visitor logs in or out of the website. + * This field should NOT have a fixed value such as `unknown_visitor`. + * The field must be a UTF-8 encoded string with a length limit of 128 + * characters. Otherwise, an `INVALID_ARGUMENT` error is returned. + * + * Generated from protobuf field string user_pseudo_id = 12; + * @param string $var + * @return $this + */ + public function setUserPseudoId($var) + { + GPBUtil::checkString($var, True); + $this->user_pseudo_id = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/AnswerGenerationSpec.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/AnswerGenerationSpec.php new file mode 100644 index 000000000000..0bd500071a5d --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/AnswerGenerationSpec.php @@ -0,0 +1,382 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec + */ +class AnswerGenerationSpec extends \Google\Protobuf\Internal\Message +{ + /** + * Answer generation model specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec.ModelSpec model_spec = 1; + */ + protected $model_spec = null; + /** + * Answer generation prompt specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec.PromptSpec prompt_spec = 2; + */ + protected $prompt_spec = null; + /** + * Specifies whether to include citation metadata in the answer. The default + * value is `false`. + * + * Generated from protobuf field bool include_citations = 3; + */ + protected $include_citations = false; + /** + * Language code for Answer. Use language tags defined by + * [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). + * Note: This is an experimental feature. + * + * Generated from protobuf field string answer_language_code = 4; + */ + protected $answer_language_code = ''; + /** + * Specifies whether to filter out adversarial queries. The default value + * is `false`. + * Google employs search-query classification to detect adversarial + * queries. No answer is returned if the search query is classified as an + * adversarial query. For example, a user might ask a question regarding + * negative comments about the company or submit a query designed to + * generate unsafe, policy-violating output. If this field is set to + * `true`, we skip generating answers for adversarial queries and return + * fallback messages instead. + * + * Generated from protobuf field bool ignore_adversarial_query = 5; + */ + protected $ignore_adversarial_query = false; + /** + * Specifies whether to filter out queries that are not answer-seeking. + * The default value is `false`. + * Google employs search-query classification to detect answer-seeking + * queries. No answer is returned if the search query is classified as a + * non-answer seeking query. If this field is set to `true`, we skip + * generating answers for non-answer seeking queries and return + * fallback messages instead. + * + * Generated from protobuf field bool ignore_non_answer_seeking_query = 6; + */ + protected $ignore_non_answer_seeking_query = false; + /** + * Specifies whether to filter out queries that have low relevance. + * If this field is set to `false`, all search results are used regardless + * of relevance to generate answers. If set to `true` or unset, the behavior + * will be determined automatically by the service. + * + * Generated from protobuf field optional bool ignore_low_relevant_content = 7; + */ + protected $ignore_low_relevant_content = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec\ModelSpec $model_spec + * Answer generation model specification. + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec\PromptSpec $prompt_spec + * Answer generation prompt specification. + * @type bool $include_citations + * Specifies whether to include citation metadata in the answer. The default + * value is `false`. + * @type string $answer_language_code + * Language code for Answer. Use language tags defined by + * [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). + * Note: This is an experimental feature. + * @type bool $ignore_adversarial_query + * Specifies whether to filter out adversarial queries. The default value + * is `false`. + * Google employs search-query classification to detect adversarial + * queries. No answer is returned if the search query is classified as an + * adversarial query. For example, a user might ask a question regarding + * negative comments about the company or submit a query designed to + * generate unsafe, policy-violating output. If this field is set to + * `true`, we skip generating answers for adversarial queries and return + * fallback messages instead. + * @type bool $ignore_non_answer_seeking_query + * Specifies whether to filter out queries that are not answer-seeking. + * The default value is `false`. + * Google employs search-query classification to detect answer-seeking + * queries. No answer is returned if the search query is classified as a + * non-answer seeking query. If this field is set to `true`, we skip + * generating answers for non-answer seeking queries and return + * fallback messages instead. + * @type bool $ignore_low_relevant_content + * Specifies whether to filter out queries that have low relevance. + * If this field is set to `false`, all search results are used regardless + * of relevance to generate answers. If set to `true` or unset, the behavior + * will be determined automatically by the service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Answer generation model specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec.ModelSpec model_spec = 1; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec\ModelSpec|null + */ + public function getModelSpec() + { + return $this->model_spec; + } + + public function hasModelSpec() + { + return isset($this->model_spec); + } + + public function clearModelSpec() + { + unset($this->model_spec); + } + + /** + * Answer generation model specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec.ModelSpec model_spec = 1; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec\ModelSpec $var + * @return $this + */ + public function setModelSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec\ModelSpec::class); + $this->model_spec = $var; + + return $this; + } + + /** + * Answer generation prompt specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec.PromptSpec prompt_spec = 2; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec\PromptSpec|null + */ + public function getPromptSpec() + { + return $this->prompt_spec; + } + + public function hasPromptSpec() + { + return isset($this->prompt_spec); + } + + public function clearPromptSpec() + { + unset($this->prompt_spec); + } + + /** + * Answer generation prompt specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec.PromptSpec prompt_spec = 2; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec\PromptSpec $var + * @return $this + */ + public function setPromptSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\AnswerGenerationSpec\PromptSpec::class); + $this->prompt_spec = $var; + + return $this; + } + + /** + * Specifies whether to include citation metadata in the answer. The default + * value is `false`. + * + * Generated from protobuf field bool include_citations = 3; + * @return bool + */ + public function getIncludeCitations() + { + return $this->include_citations; + } + + /** + * Specifies whether to include citation metadata in the answer. The default + * value is `false`. + * + * Generated from protobuf field bool include_citations = 3; + * @param bool $var + * @return $this + */ + public function setIncludeCitations($var) + { + GPBUtil::checkBool($var); + $this->include_citations = $var; + + return $this; + } + + /** + * Language code for Answer. Use language tags defined by + * [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). + * Note: This is an experimental feature. + * + * Generated from protobuf field string answer_language_code = 4; + * @return string + */ + public function getAnswerLanguageCode() + { + return $this->answer_language_code; + } + + /** + * Language code for Answer. Use language tags defined by + * [BCP47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt). + * Note: This is an experimental feature. + * + * Generated from protobuf field string answer_language_code = 4; + * @param string $var + * @return $this + */ + public function setAnswerLanguageCode($var) + { + GPBUtil::checkString($var, True); + $this->answer_language_code = $var; + + return $this; + } + + /** + * Specifies whether to filter out adversarial queries. The default value + * is `false`. + * Google employs search-query classification to detect adversarial + * queries. No answer is returned if the search query is classified as an + * adversarial query. For example, a user might ask a question regarding + * negative comments about the company or submit a query designed to + * generate unsafe, policy-violating output. If this field is set to + * `true`, we skip generating answers for adversarial queries and return + * fallback messages instead. + * + * Generated from protobuf field bool ignore_adversarial_query = 5; + * @return bool + */ + public function getIgnoreAdversarialQuery() + { + return $this->ignore_adversarial_query; + } + + /** + * Specifies whether to filter out adversarial queries. The default value + * is `false`. + * Google employs search-query classification to detect adversarial + * queries. No answer is returned if the search query is classified as an + * adversarial query. For example, a user might ask a question regarding + * negative comments about the company or submit a query designed to + * generate unsafe, policy-violating output. If this field is set to + * `true`, we skip generating answers for adversarial queries and return + * fallback messages instead. + * + * Generated from protobuf field bool ignore_adversarial_query = 5; + * @param bool $var + * @return $this + */ + public function setIgnoreAdversarialQuery($var) + { + GPBUtil::checkBool($var); + $this->ignore_adversarial_query = $var; + + return $this; + } + + /** + * Specifies whether to filter out queries that are not answer-seeking. + * The default value is `false`. + * Google employs search-query classification to detect answer-seeking + * queries. No answer is returned if the search query is classified as a + * non-answer seeking query. If this field is set to `true`, we skip + * generating answers for non-answer seeking queries and return + * fallback messages instead. + * + * Generated from protobuf field bool ignore_non_answer_seeking_query = 6; + * @return bool + */ + public function getIgnoreNonAnswerSeekingQuery() + { + return $this->ignore_non_answer_seeking_query; + } + + /** + * Specifies whether to filter out queries that are not answer-seeking. + * The default value is `false`. + * Google employs search-query classification to detect answer-seeking + * queries. No answer is returned if the search query is classified as a + * non-answer seeking query. If this field is set to `true`, we skip + * generating answers for non-answer seeking queries and return + * fallback messages instead. + * + * Generated from protobuf field bool ignore_non_answer_seeking_query = 6; + * @param bool $var + * @return $this + */ + public function setIgnoreNonAnswerSeekingQuery($var) + { + GPBUtil::checkBool($var); + $this->ignore_non_answer_seeking_query = $var; + + return $this; + } + + /** + * Specifies whether to filter out queries that have low relevance. + * If this field is set to `false`, all search results are used regardless + * of relevance to generate answers. If set to `true` or unset, the behavior + * will be determined automatically by the service. + * + * Generated from protobuf field optional bool ignore_low_relevant_content = 7; + * @return bool + */ + public function getIgnoreLowRelevantContent() + { + return isset($this->ignore_low_relevant_content) ? $this->ignore_low_relevant_content : false; + } + + public function hasIgnoreLowRelevantContent() + { + return isset($this->ignore_low_relevant_content); + } + + public function clearIgnoreLowRelevantContent() + { + unset($this->ignore_low_relevant_content); + } + + /** + * Specifies whether to filter out queries that have low relevance. + * If this field is set to `false`, all search results are used regardless + * of relevance to generate answers. If set to `true` or unset, the behavior + * will be determined automatically by the service. + * + * Generated from protobuf field optional bool ignore_low_relevant_content = 7; + * @param bool $var + * @return $this + */ + public function setIgnoreLowRelevantContent($var) + { + GPBUtil::checkBool($var); + $this->ignore_low_relevant_content = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/AnswerGenerationSpec/ModelSpec.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/AnswerGenerationSpec/ModelSpec.php new file mode 100644 index 000000000000..0bbb1be7a964 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/AnswerGenerationSpec/ModelSpec.php @@ -0,0 +1,72 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec.ModelSpec + */ +class ModelSpec extends \Google\Protobuf\Internal\Message +{ + /** + * Model version. If not set, it will use the default stable model. + * Allowed values are: stable, preview. + * + * Generated from protobuf field string model_version = 1; + */ + protected $model_version = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $model_version + * Model version. If not set, it will use the default stable model. + * Allowed values are: stable, preview. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Model version. If not set, it will use the default stable model. + * Allowed values are: stable, preview. + * + * Generated from protobuf field string model_version = 1; + * @return string + */ + public function getModelVersion() + { + return $this->model_version; + } + + /** + * Model version. If not set, it will use the default stable model. + * Allowed values are: stable, preview. + * + * Generated from protobuf field string model_version = 1; + * @param string $var + * @return $this + */ + public function setModelVersion($var) + { + GPBUtil::checkString($var, True); + $this->model_version = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/AnswerGenerationSpec/PromptSpec.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/AnswerGenerationSpec/PromptSpec.php new file mode 100644 index 000000000000..758aae9a0fad --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/AnswerGenerationSpec/PromptSpec.php @@ -0,0 +1,68 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.AnswerGenerationSpec.PromptSpec + */ +class PromptSpec extends \Google\Protobuf\Internal\Message +{ + /** + * Customized preamble. + * + * Generated from protobuf field string preamble = 1; + */ + protected $preamble = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $preamble + * Customized preamble. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Customized preamble. + * + * Generated from protobuf field string preamble = 1; + * @return string + */ + public function getPreamble() + { + return $this->preamble; + } + + /** + * Customized preamble. + * + * Generated from protobuf field string preamble = 1; + * @param string $var + * @return $this + */ + public function setPreamble($var) + { + GPBUtil::checkString($var, True); + $this->preamble = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec.php new file mode 100644 index 000000000000..97fc5ba96639 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec.php @@ -0,0 +1,122 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec + */ +class QueryUnderstandingSpec extends \Google\Protobuf\Internal\Message +{ + /** + * Query classification specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec query_classification_spec = 1; + */ + protected $query_classification_spec = null; + /** + * Query rephraser specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec query_rephraser_spec = 2; + */ + protected $query_rephraser_spec = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec\QueryClassificationSpec $query_classification_spec + * Query classification specification. + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec\QueryRephraserSpec $query_rephraser_spec + * Query rephraser specification. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Query classification specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec query_classification_spec = 1; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec\QueryClassificationSpec|null + */ + public function getQueryClassificationSpec() + { + return $this->query_classification_spec; + } + + public function hasQueryClassificationSpec() + { + return isset($this->query_classification_spec); + } + + public function clearQueryClassificationSpec() + { + unset($this->query_classification_spec); + } + + /** + * Query classification specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec query_classification_spec = 1; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec\QueryClassificationSpec $var + * @return $this + */ + public function setQueryClassificationSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec\QueryClassificationSpec::class); + $this->query_classification_spec = $var; + + return $this; + } + + /** + * Query rephraser specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec query_rephraser_spec = 2; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec\QueryRephraserSpec|null + */ + public function getQueryRephraserSpec() + { + return $this->query_rephraser_spec; + } + + public function hasQueryRephraserSpec() + { + return isset($this->query_rephraser_spec); + } + + public function clearQueryRephraserSpec() + { + unset($this->query_rephraser_spec); + } + + /** + * Query rephraser specification. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec query_rephraser_spec = 2; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec\QueryRephraserSpec $var + * @return $this + */ + public function setQueryRephraserSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec\QueryRephraserSpec::class); + $this->query_rephraser_spec = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec/QueryClassificationSpec.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec/QueryClassificationSpec.php new file mode 100644 index 000000000000..8874265c1b57 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec/QueryClassificationSpec.php @@ -0,0 +1,68 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec + */ +class QueryClassificationSpec extends \Google\Protobuf\Internal\Message +{ + /** + * Enabled query classification types. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec.Type types = 1; + */ + private $types; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $types + * Enabled query classification types. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Enabled query classification types. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec.Type types = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTypes() + { + return $this->types; + } + + /** + * Enabled query classification types. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec.Type types = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTypes($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\QueryUnderstandingSpec\QueryClassificationSpec\Type::class); + $this->types = $arr; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec/QueryClassificationSpec/Type.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec/QueryClassificationSpec/Type.php new file mode 100644 index 000000000000..999036f847d0 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec/QueryClassificationSpec/Type.php @@ -0,0 +1,62 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryClassificationSpec.Type + */ +class Type +{ + /** + * Unspecified query classification type. + * + * Generated from protobuf enum TYPE_UNSPECIFIED = 0; + */ + const TYPE_UNSPECIFIED = 0; + /** + * Adversarial query classification type. + * + * Generated from protobuf enum ADVERSARIAL_QUERY = 1; + */ + const ADVERSARIAL_QUERY = 1; + /** + * Non-answer-seeking query classification type. + * + * Generated from protobuf enum NON_ANSWER_SEEKING_QUERY = 2; + */ + const NON_ANSWER_SEEKING_QUERY = 2; + + private static $valueToName = [ + self::TYPE_UNSPECIFIED => 'TYPE_UNSPECIFIED', + self::ADVERSARIAL_QUERY => 'ADVERSARIAL_QUERY', + self::NON_ANSWER_SEEKING_QUERY => 'NON_ANSWER_SEEKING_QUERY', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec/QueryRephraserSpec.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec/QueryRephraserSpec.php new file mode 100644 index 000000000000..8a27216065ec --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/QueryUnderstandingSpec/QueryRephraserSpec.php @@ -0,0 +1,68 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.QueryUnderstandingSpec.QueryRephraserSpec + */ +class QueryRephraserSpec extends \Google\Protobuf\Internal\Message +{ + /** + * Disable query rephraser. + * + * Generated from protobuf field bool disable = 1; + */ + protected $disable = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $disable + * Disable query rephraser. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Disable query rephraser. + * + * Generated from protobuf field bool disable = 1; + * @return bool + */ + public function getDisable() + { + return $this->disable; + } + + /** + * Disable query rephraser. + * + * Generated from protobuf field bool disable = 1; + * @param bool $var + * @return $this + */ + public function setDisable($var) + { + GPBUtil::checkBool($var); + $this->disable = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/RelatedQuestionsSpec.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/RelatedQuestionsSpec.php new file mode 100644 index 000000000000..3ea8e46d04d0 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/RelatedQuestionsSpec.php @@ -0,0 +1,68 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.RelatedQuestionsSpec + */ +class RelatedQuestionsSpec extends \Google\Protobuf\Internal\Message +{ + /** + * Enable related questions feature if true. + * + * Generated from protobuf field bool enable = 1; + */ + protected $enable = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enable + * Enable related questions feature if true. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Enable related questions feature if true. + * + * Generated from protobuf field bool enable = 1; + * @return bool + */ + public function getEnable() + { + return $this->enable; + } + + /** + * Enable related questions feature if true. + * + * Generated from protobuf field bool enable = 1; + * @param bool $var + * @return $this + */ + public function setEnable($var) + { + GPBUtil::checkBool($var); + $this->enable = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/SafetySpec.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/SafetySpec.php new file mode 100644 index 000000000000..1f3e7fdccf3f --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/SafetySpec.php @@ -0,0 +1,72 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.SafetySpec + */ +class SafetySpec extends \Google\Protobuf\Internal\Message +{ + /** + * Enable the safety filtering on the answer response. It is false by + * default. + * + * Generated from protobuf field bool enable = 1; + */ + protected $enable = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type bool $enable + * Enable the safety filtering on the answer response. It is false by + * default. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Enable the safety filtering on the answer response. It is false by + * default. + * + * Generated from protobuf field bool enable = 1; + * @return bool + */ + public function getEnable() + { + return $this->enable; + } + + /** + * Enable the safety filtering on the answer response. It is false by + * default. + * + * Generated from protobuf field bool enable = 1; + * @param bool $var + * @return $this + */ + public function setEnable($var) + { + GPBUtil::checkBool($var); + $this->enable = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec.php new file mode 100644 index 000000000000..d10a87a1e87e --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec.php @@ -0,0 +1,109 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec + */ +class SearchSpec extends \Google\Protobuf\Internal\Message +{ + protected $input; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchParams $search_params + * Search parameters. + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList $search_result_list + * Search result list. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Search parameters. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchParams search_params = 1; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchParams|null + */ + public function getSearchParams() + { + return $this->readOneof(1); + } + + public function hasSearchParams() + { + return $this->hasOneof(1); + } + + /** + * Search parameters. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchParams search_params = 1; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchParams $var + * @return $this + */ + public function setSearchParams($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchParams::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Search result list. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList search_result_list = 2; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList|null + */ + public function getSearchResultList() + { + return $this->readOneof(2); + } + + public function hasSearchResultList() + { + return $this->hasOneof(2); + } + + /** + * Search result list. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList search_result_list = 2; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList $var + * @return $this + */ + public function setSearchResultList($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getInput() + { + return $this->whichOneof("input"); + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchParams.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchParams.php new file mode 100644 index 000000000000..63c432286a67 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchParams.php @@ -0,0 +1,310 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchParams + */ +class SearchParams extends \Google\Protobuf\Internal\Message +{ + /** + * Number of search results to return. + * The default value is 10. + * + * Generated from protobuf field int32 max_return_results = 1; + */ + protected $max_return_results = 0; + /** + * The filter syntax consists of an expression language for constructing + * a predicate from one or more fields of the documents being filtered. + * Filter expression is case-sensitive. This will be used to filter + * search results which may affect the Answer response. + * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + * Filtering in Vertex AI Search is done by mapping the LHS filter key + * to a key property defined in the Vertex AI Search backend -- this + * mapping is defined by the customer in their schema. For example a + * media customers might have a field 'name' in their schema. In this + * case the filter would look like this: filter --> name:'ANY("king + * kong")' + * For more information about filtering including syntax and filter + * operators, see + * [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata) + * + * Generated from protobuf field string filter = 2; + */ + protected $filter = ''; + /** + * Boost specification to boost certain documents in search results which + * may affect the answer query response. For more information on boosting, + * see [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.SearchRequest.BoostSpec boost_spec = 3; + */ + protected $boost_spec = null; + /** + * The order in which documents are returned. Documents can be ordered + * by a field in an [Document][google.cloud.discoveryengine.v1.Document] + * object. Leave it unset if ordered by relevance. `order_by` expression + * is case-sensitive. For more information on ordering, see + * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) + * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + * + * Generated from protobuf field string order_by = 4; + */ + protected $order_by = ''; + /** + * Specs defining dataStores to filter on in a search call and + * configurations for those dataStores. This is only considered for + * engines with multiple dataStores use case. For single dataStore within + * an engine, they should use the specs at the top level. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.SearchRequest.DataStoreSpec data_store_specs = 7; + */ + private $data_store_specs; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $max_return_results + * Number of search results to return. + * The default value is 10. + * @type string $filter + * The filter syntax consists of an expression language for constructing + * a predicate from one or more fields of the documents being filtered. + * Filter expression is case-sensitive. This will be used to filter + * search results which may affect the Answer response. + * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + * Filtering in Vertex AI Search is done by mapping the LHS filter key + * to a key property defined in the Vertex AI Search backend -- this + * mapping is defined by the customer in their schema. For example a + * media customers might have a field 'name' in their schema. In this + * case the filter would look like this: filter --> name:'ANY("king + * kong")' + * For more information about filtering including syntax and filter + * operators, see + * [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata) + * @type \Google\Cloud\DiscoveryEngine\V1\SearchRequest\BoostSpec $boost_spec + * Boost specification to boost certain documents in search results which + * may affect the answer query response. For more information on boosting, + * see [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * @type string $order_by + * The order in which documents are returned. Documents can be ordered + * by a field in an [Document][google.cloud.discoveryengine.v1.Document] + * object. Leave it unset if ordered by relevance. `order_by` expression + * is case-sensitive. For more information on ordering, see + * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) + * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + * @type array<\Google\Cloud\DiscoveryEngine\V1\SearchRequest\DataStoreSpec>|\Google\Protobuf\Internal\RepeatedField $data_store_specs + * Specs defining dataStores to filter on in a search call and + * configurations for those dataStores. This is only considered for + * engines with multiple dataStores use case. For single dataStore within + * an engine, they should use the specs at the top level. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Number of search results to return. + * The default value is 10. + * + * Generated from protobuf field int32 max_return_results = 1; + * @return int + */ + public function getMaxReturnResults() + { + return $this->max_return_results; + } + + /** + * Number of search results to return. + * The default value is 10. + * + * Generated from protobuf field int32 max_return_results = 1; + * @param int $var + * @return $this + */ + public function setMaxReturnResults($var) + { + GPBUtil::checkInt32($var); + $this->max_return_results = $var; + + return $this; + } + + /** + * The filter syntax consists of an expression language for constructing + * a predicate from one or more fields of the documents being filtered. + * Filter expression is case-sensitive. This will be used to filter + * search results which may affect the Answer response. + * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + * Filtering in Vertex AI Search is done by mapping the LHS filter key + * to a key property defined in the Vertex AI Search backend -- this + * mapping is defined by the customer in their schema. For example a + * media customers might have a field 'name' in their schema. In this + * case the filter would look like this: filter --> name:'ANY("king + * kong")' + * For more information about filtering including syntax and filter + * operators, see + * [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata) + * + * Generated from protobuf field string filter = 2; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * The filter syntax consists of an expression language for constructing + * a predicate from one or more fields of the documents being filtered. + * Filter expression is case-sensitive. This will be used to filter + * search results which may affect the Answer response. + * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + * Filtering in Vertex AI Search is done by mapping the LHS filter key + * to a key property defined in the Vertex AI Search backend -- this + * mapping is defined by the customer in their schema. For example a + * media customers might have a field 'name' in their schema. In this + * case the filter would look like this: filter --> name:'ANY("king + * kong")' + * For more information about filtering including syntax and filter + * operators, see + * [Filter](https://cloud.google.com/generative-ai-app-builder/docs/filter-search-metadata) + * + * Generated from protobuf field string filter = 2; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Boost specification to boost certain documents in search results which + * may affect the answer query response. For more information on boosting, + * see [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.SearchRequest.BoostSpec boost_spec = 3; + * @return \Google\Cloud\DiscoveryEngine\V1\SearchRequest\BoostSpec|null + */ + public function getBoostSpec() + { + return $this->boost_spec; + } + + public function hasBoostSpec() + { + return isset($this->boost_spec); + } + + public function clearBoostSpec() + { + unset($this->boost_spec); + } + + /** + * Boost specification to boost certain documents in search results which + * may affect the answer query response. For more information on boosting, + * see [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.SearchRequest.BoostSpec boost_spec = 3; + * @param \Google\Cloud\DiscoveryEngine\V1\SearchRequest\BoostSpec $var + * @return $this + */ + public function setBoostSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\SearchRequest\BoostSpec::class); + $this->boost_spec = $var; + + return $this; + } + + /** + * The order in which documents are returned. Documents can be ordered + * by a field in an [Document][google.cloud.discoveryengine.v1.Document] + * object. Leave it unset if ordered by relevance. `order_by` expression + * is case-sensitive. For more information on ordering, see + * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) + * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + * + * Generated from protobuf field string order_by = 4; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * The order in which documents are returned. Documents can be ordered + * by a field in an [Document][google.cloud.discoveryengine.v1.Document] + * object. Leave it unset if ordered by relevance. `order_by` expression + * is case-sensitive. For more information on ordering, see + * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) + * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + * + * Generated from protobuf field string order_by = 4; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + + /** + * Specs defining dataStores to filter on in a search call and + * configurations for those dataStores. This is only considered for + * engines with multiple dataStores use case. For single dataStore within + * an engine, they should use the specs at the top level. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.SearchRequest.DataStoreSpec data_store_specs = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDataStoreSpecs() + { + return $this->data_store_specs; + } + + /** + * Specs defining dataStores to filter on in a search call and + * configurations for those dataStores. This is only considered for + * engines with multiple dataStores use case. For single dataStore within + * an engine, they should use the specs at the top level. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.SearchRequest.DataStoreSpec data_store_specs = 7; + * @param array<\Google\Cloud\DiscoveryEngine\V1\SearchRequest\DataStoreSpec>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDataStoreSpecs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\SearchRequest\DataStoreSpec::class); + $this->data_store_specs = $arr; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList.php new file mode 100644 index 000000000000..fbae8a1f757a --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList.php @@ -0,0 +1,68 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList + */ +class SearchResultList extends \Google\Protobuf\Internal\Message +{ + /** + * Search results. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult search_results = 1; + */ + private $search_results; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult>|\Google\Protobuf\Internal\RepeatedField $search_results + * Search results. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Search results. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult search_results = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSearchResults() + { + return $this->search_results; + } + + /** + * Search results. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult search_results = 1; + * @param array<\Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSearchResults($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult::class); + $this->search_results = $arr; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult.php new file mode 100644 index 000000000000..bc72f2679af0 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult.php @@ -0,0 +1,109 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult + */ +class SearchResult extends \Google\Protobuf\Internal\Message +{ + protected $content; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo $unstructured_document_info + * Unstructured document information. + * @type \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\ChunkInfo $chunk_info + * Chunk information. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Unstructured document information. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo unstructured_document_info = 1; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo|null + */ + public function getUnstructuredDocumentInfo() + { + return $this->readOneof(1); + } + + public function hasUnstructuredDocumentInfo() + { + return $this->hasOneof(1); + } + + /** + * Unstructured document information. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo unstructured_document_info = 1; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo $var + * @return $this + */ + public function setUnstructuredDocumentInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Chunk information. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.ChunkInfo chunk_info = 2; + * @return \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\ChunkInfo|null + */ + public function getChunkInfo() + { + return $this->readOneof(2); + } + + public function hasChunkInfo() + { + return $this->hasOneof(2); + } + + /** + * Chunk information. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.ChunkInfo chunk_info = 2; + * @param \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\ChunkInfo $var + * @return $this + */ + public function setChunkInfo($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\ChunkInfo::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getContent() + { + return $this->whichOneof("content"); + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/ChunkInfo.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/ChunkInfo.php new file mode 100644 index 000000000000..b35fda5b1b26 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/ChunkInfo.php @@ -0,0 +1,102 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.ChunkInfo + */ +class ChunkInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Chunk resource name. + * + * Generated from protobuf field string chunk = 1 [(.google.api.resource_reference) = { + */ + protected $chunk = ''; + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 2; + */ + protected $content = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $chunk + * Chunk resource name. + * @type string $content + * Chunk textual content. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Chunk resource name. + * + * Generated from protobuf field string chunk = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getChunk() + { + return $this->chunk; + } + + /** + * Chunk resource name. + * + * Generated from protobuf field string chunk = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setChunk($var) + { + GPBUtil::checkString($var, True); + $this->chunk = $var; + + return $this; + } + + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 2; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Chunk textual content. + * + * Generated from protobuf field string content = 2; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo.php new file mode 100644 index 000000000000..532d17bbfe72 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo.php @@ -0,0 +1,238 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo + */ +class UnstructuredDocumentInfo extends \Google\Protobuf\Internal\Message +{ + /** + * Document resource name. + * + * Generated from protobuf field string document = 1 [(.google.api.resource_reference) = { + */ + protected $document = ''; + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + */ + protected $uri = ''; + /** + * Title. + * + * Generated from protobuf field string title = 3; + */ + protected $title = ''; + /** + * List of document contexts. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.DocumentContext document_contexts = 4; + */ + private $document_contexts; + /** + * List of extractive segments. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveSegment extractive_segments = 5; + */ + private $extractive_segments; + /** + * List of extractive answers. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveAnswer extractive_answers = 6; + */ + private $extractive_answers; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $document + * Document resource name. + * @type string $uri + * URI for the document. + * @type string $title + * Title. + * @type array<\Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo\DocumentContext>|\Google\Protobuf\Internal\RepeatedField $document_contexts + * List of document contexts. + * @type array<\Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo\ExtractiveSegment>|\Google\Protobuf\Internal\RepeatedField $extractive_segments + * List of extractive segments. + * @type array<\Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo\ExtractiveAnswer>|\Google\Protobuf\Internal\RepeatedField $extractive_answers + * List of extractive answers. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Document resource name. + * + * Generated from protobuf field string document = 1 [(.google.api.resource_reference) = { + * @return string + */ + public function getDocument() + { + return $this->document; + } + + /** + * Document resource name. + * + * Generated from protobuf field string document = 1 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDocument($var) + { + GPBUtil::checkString($var, True); + $this->document = $var; + + return $this; + } + + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + * @return string + */ + public function getUri() + { + return $this->uri; + } + + /** + * URI for the document. + * + * Generated from protobuf field string uri = 2; + * @param string $var + * @return $this + */ + public function setUri($var) + { + GPBUtil::checkString($var, True); + $this->uri = $var; + + return $this; + } + + /** + * Title. + * + * Generated from protobuf field string title = 3; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * Title. + * + * Generated from protobuf field string title = 3; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * List of document contexts. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.DocumentContext document_contexts = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDocumentContexts() + { + return $this->document_contexts; + } + + /** + * List of document contexts. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.DocumentContext document_contexts = 4; + * @param array<\Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo\DocumentContext>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDocumentContexts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo\DocumentContext::class); + $this->document_contexts = $arr; + + return $this; + } + + /** + * List of extractive segments. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveSegment extractive_segments = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExtractiveSegments() + { + return $this->extractive_segments; + } + + /** + * List of extractive segments. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveSegment extractive_segments = 5; + * @param array<\Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo\ExtractiveSegment>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExtractiveSegments($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo\ExtractiveSegment::class); + $this->extractive_segments = $arr; + + return $this; + } + + /** + * List of extractive answers. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveAnswer extractive_answers = 6; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getExtractiveAnswers() + { + return $this->extractive_answers; + } + + /** + * List of extractive answers. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveAnswer extractive_answers = 6; + * @param array<\Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo\ExtractiveAnswer>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setExtractiveAnswers($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest\SearchSpec\SearchResultList\SearchResult\UnstructuredDocumentInfo\ExtractiveAnswer::class); + $this->extractive_answers = $arr; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo/DocumentContext.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo/DocumentContext.php new file mode 100644 index 000000000000..6c15269c9a25 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo/DocumentContext.php @@ -0,0 +1,102 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.DocumentContext + */ +class DocumentContext extends \Google\Protobuf\Internal\Message +{ + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 1; + */ + protected $page_identifier = ''; + /** + * Document content. + * + * Generated from protobuf field string content = 2; + */ + protected $content = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $page_identifier + * Page identifier. + * @type string $content + * Document content. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 1; + * @return string + */ + public function getPageIdentifier() + { + return $this->page_identifier; + } + + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 1; + * @param string $var + * @return $this + */ + public function setPageIdentifier($var) + { + GPBUtil::checkString($var, True); + $this->page_identifier = $var; + + return $this; + } + + /** + * Document content. + * + * Generated from protobuf field string content = 2; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Document content. + * + * Generated from protobuf field string content = 2; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo/ExtractiveAnswer.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo/ExtractiveAnswer.php new file mode 100644 index 000000000000..065171d95ee5 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo/ExtractiveAnswer.php @@ -0,0 +1,103 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveAnswer + */ +class ExtractiveAnswer extends \Google\Protobuf\Internal\Message +{ + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 1; + */ + protected $page_identifier = ''; + /** + * Extractive answer content. + * + * Generated from protobuf field string content = 2; + */ + protected $content = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $page_identifier + * Page identifier. + * @type string $content + * Extractive answer content. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 1; + * @return string + */ + public function getPageIdentifier() + { + return $this->page_identifier; + } + + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 1; + * @param string $var + * @return $this + */ + public function setPageIdentifier($var) + { + GPBUtil::checkString($var, True); + $this->page_identifier = $var; + + return $this; + } + + /** + * Extractive answer content. + * + * Generated from protobuf field string content = 2; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Extractive answer content. + * + * Generated from protobuf field string content = 2; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo/ExtractiveSegment.php b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo/ExtractiveSegment.php new file mode 100644 index 000000000000..4857b57330d6 --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryRequest/SearchSpec/SearchResultList/SearchResult/UnstructuredDocumentInfo/ExtractiveSegment.php @@ -0,0 +1,103 @@ +google.cloud.discoveryengine.v1.AnswerQueryRequest.SearchSpec.SearchResultList.SearchResult.UnstructuredDocumentInfo.ExtractiveSegment + */ +class ExtractiveSegment extends \Google\Protobuf\Internal\Message +{ + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 1; + */ + protected $page_identifier = ''; + /** + * Extractive segment content. + * + * Generated from protobuf field string content = 2; + */ + protected $content = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $page_identifier + * Page identifier. + * @type string $content + * Extractive segment content. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 1; + * @return string + */ + public function getPageIdentifier() + { + return $this->page_identifier; + } + + /** + * Page identifier. + * + * Generated from protobuf field string page_identifier = 1; + * @param string $var + * @return $this + */ + public function setPageIdentifier($var) + { + GPBUtil::checkString($var, True); + $this->page_identifier = $var; + + return $this; + } + + /** + * Extractive segment content. + * + * Generated from protobuf field string content = 2; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * Extractive segment content. + * + * Generated from protobuf field string content = 2; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/AnswerQueryResponse.php b/DiscoveryEngine/src/V1/AnswerQueryResponse.php new file mode 100644 index 000000000000..c27780c98d7c --- /dev/null +++ b/DiscoveryEngine/src/V1/AnswerQueryResponse.php @@ -0,0 +1,189 @@ +google.cloud.discoveryengine.v1.AnswerQueryResponse + */ +class AnswerQueryResponse extends \Google\Protobuf\Internal\Message +{ + /** + * Answer resource object. + * If [AnswerQueryRequest.StepSpec.max_step_count][] is greater than 1, + * use [Answer.name][google.cloud.discoveryengine.v1.Answer.name] to fetch + * answer information using + * [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1.ConversationalSearchService.GetAnswer] + * API. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer answer = 1; + */ + protected $answer = null; + /** + * Session resource object. + * It will be only available when session field is set and valid in the + * [AnswerQueryRequest][google.cloud.discoveryengine.v1.AnswerQueryRequest] + * request. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session session = 2; + */ + protected $session = null; + /** + * A global unique ID used for logging. + * + * Generated from protobuf field string answer_query_token = 3; + */ + protected $answer_query_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\Answer $answer + * Answer resource object. + * If [AnswerQueryRequest.StepSpec.max_step_count][] is greater than 1, + * use [Answer.name][google.cloud.discoveryengine.v1.Answer.name] to fetch + * answer information using + * [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1.ConversationalSearchService.GetAnswer] + * API. + * @type \Google\Cloud\DiscoveryEngine\V1\Session $session + * Session resource object. + * It will be only available when session field is set and valid in the + * [AnswerQueryRequest][google.cloud.discoveryengine.v1.AnswerQueryRequest] + * request. + * @type string $answer_query_token + * A global unique ID used for logging. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Answer resource object. + * If [AnswerQueryRequest.StepSpec.max_step_count][] is greater than 1, + * use [Answer.name][google.cloud.discoveryengine.v1.Answer.name] to fetch + * answer information using + * [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1.ConversationalSearchService.GetAnswer] + * API. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer answer = 1; + * @return \Google\Cloud\DiscoveryEngine\V1\Answer|null + */ + public function getAnswer() + { + return $this->answer; + } + + public function hasAnswer() + { + return isset($this->answer); + } + + public function clearAnswer() + { + unset($this->answer); + } + + /** + * Answer resource object. + * If [AnswerQueryRequest.StepSpec.max_step_count][] is greater than 1, + * use [Answer.name][google.cloud.discoveryengine.v1.Answer.name] to fetch + * answer information using + * [ConversationalSearchService.GetAnswer][google.cloud.discoveryengine.v1.ConversationalSearchService.GetAnswer] + * API. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Answer answer = 1; + * @param \Google\Cloud\DiscoveryEngine\V1\Answer $var + * @return $this + */ + public function setAnswer($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Answer::class); + $this->answer = $var; + + return $this; + } + + /** + * Session resource object. + * It will be only available when session field is set and valid in the + * [AnswerQueryRequest][google.cloud.discoveryengine.v1.AnswerQueryRequest] + * request. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session session = 2; + * @return \Google\Cloud\DiscoveryEngine\V1\Session|null + */ + public function getSession() + { + return $this->session; + } + + public function hasSession() + { + return isset($this->session); + } + + public function clearSession() + { + unset($this->session); + } + + /** + * Session resource object. + * It will be only available when session field is set and valid in the + * [AnswerQueryRequest][google.cloud.discoveryengine.v1.AnswerQueryRequest] + * request. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session session = 2; + * @param \Google\Cloud\DiscoveryEngine\V1\Session $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Session::class); + $this->session = $var; + + return $this; + } + + /** + * A global unique ID used for logging. + * + * Generated from protobuf field string answer_query_token = 3; + * @return string + */ + public function getAnswerQueryToken() + { + return $this->answer_query_token; + } + + /** + * A global unique ID used for logging. + * + * Generated from protobuf field string answer_query_token = 3; + * @param string $var + * @return $this + */ + public function setAnswerQueryToken($var) + { + GPBUtil::checkString($var, True); + $this->answer_query_token = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/CheckGroundingRequest.php b/DiscoveryEngine/src/V1/CheckGroundingRequest.php new file mode 100644 index 000000000000..70f17bf4b7a6 --- /dev/null +++ b/DiscoveryEngine/src/V1/CheckGroundingRequest.php @@ -0,0 +1,279 @@ +google.cloud.discoveryengine.v1.CheckGroundingRequest + */ +class CheckGroundingRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the grounding config, such as + * `projects/*/locations/global/groundingConfigs/default_grounding_config`. + * + * Generated from protobuf field string grounding_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $grounding_config = ''; + /** + * Answer candidate to check. Can have a maximum length of 1024 characters. + * + * Generated from protobuf field string answer_candidate = 2; + */ + protected $answer_candidate = ''; + /** + * List of facts for the grounding check. + * We support up to 200 facts. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.GroundingFact facts = 3; + */ + private $facts; + /** + * Configuration of the grounding check. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.CheckGroundingSpec grounding_spec = 4; + */ + protected $grounding_spec = null; + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 5; + */ + private $user_labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $grounding_config + * Required. The resource name of the grounding config, such as + * `projects/*/locations/global/groundingConfigs/default_grounding_config`. + * @type string $answer_candidate + * Answer candidate to check. Can have a maximum length of 1024 characters. + * @type array<\Google\Cloud\DiscoveryEngine\V1\GroundingFact>|\Google\Protobuf\Internal\RepeatedField $facts + * List of facts for the grounding check. + * We support up to 200 facts. + * @type \Google\Cloud\DiscoveryEngine\V1\CheckGroundingSpec $grounding_spec + * Configuration of the grounding check. + * @type array|\Google\Protobuf\Internal\MapField $user_labels + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\GroundedGenerationService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the grounding config, such as + * `projects/*/locations/global/groundingConfigs/default_grounding_config`. + * + * Generated from protobuf field string grounding_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getGroundingConfig() + { + return $this->grounding_config; + } + + /** + * Required. The resource name of the grounding config, such as + * `projects/*/locations/global/groundingConfigs/default_grounding_config`. + * + * Generated from protobuf field string grounding_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setGroundingConfig($var) + { + GPBUtil::checkString($var, True); + $this->grounding_config = $var; + + return $this; + } + + /** + * Answer candidate to check. Can have a maximum length of 1024 characters. + * + * Generated from protobuf field string answer_candidate = 2; + * @return string + */ + public function getAnswerCandidate() + { + return $this->answer_candidate; + } + + /** + * Answer candidate to check. Can have a maximum length of 1024 characters. + * + * Generated from protobuf field string answer_candidate = 2; + * @param string $var + * @return $this + */ + public function setAnswerCandidate($var) + { + GPBUtil::checkString($var, True); + $this->answer_candidate = $var; + + return $this; + } + + /** + * List of facts for the grounding check. + * We support up to 200 facts. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.GroundingFact facts = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getFacts() + { + return $this->facts; + } + + /** + * List of facts for the grounding check. + * We support up to 200 facts. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.GroundingFact facts = 3; + * @param array<\Google\Cloud\DiscoveryEngine\V1\GroundingFact>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setFacts($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\GroundingFact::class); + $this->facts = $arr; + + return $this; + } + + /** + * Configuration of the grounding check. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.CheckGroundingSpec grounding_spec = 4; + * @return \Google\Cloud\DiscoveryEngine\V1\CheckGroundingSpec|null + */ + public function getGroundingSpec() + { + return $this->grounding_spec; + } + + public function hasGroundingSpec() + { + return isset($this->grounding_spec); + } + + public function clearGroundingSpec() + { + unset($this->grounding_spec); + } + + /** + * Configuration of the grounding check. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.CheckGroundingSpec grounding_spec = 4; + * @param \Google\Cloud\DiscoveryEngine\V1\CheckGroundingSpec $var + * @return $this + */ + public function setGroundingSpec($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\CheckGroundingSpec::class); + $this->grounding_spec = $var; + + return $this; + } + + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getUserLabels() + { + return $this->user_labels; + } + + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setUserLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->user_labels = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/CheckGroundingResponse.php b/DiscoveryEngine/src/V1/CheckGroundingResponse.php new file mode 100644 index 000000000000..96ad7b0e3b7b --- /dev/null +++ b/DiscoveryEngine/src/V1/CheckGroundingResponse.php @@ -0,0 +1,159 @@ +google.cloud.discoveryengine.v1.CheckGroundingResponse + */ +class CheckGroundingResponse extends \Google\Protobuf\Internal\Message +{ + /** + * The support score for the input answer candidate. + * Higher the score, higher is the fraction of claims that are supported by + * the provided facts. This is always set when a response is returned. + * + * Generated from protobuf field optional float support_score = 1; + */ + protected $support_score = null; + /** + * List of facts cited across all claims in the answer candidate. + * These are derived from the facts supplied in the request. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.FactChunk cited_chunks = 3; + */ + private $cited_chunks; + /** + * Claim texts and citation info across all claims in the answer candidate. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim claims = 4; + */ + private $claims; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $support_score + * The support score for the input answer candidate. + * Higher the score, higher is the fraction of claims that are supported by + * the provided facts. This is always set when a response is returned. + * @type array<\Google\Cloud\DiscoveryEngine\V1\FactChunk>|\Google\Protobuf\Internal\RepeatedField $cited_chunks + * List of facts cited across all claims in the answer candidate. + * These are derived from the facts supplied in the request. + * @type array<\Google\Cloud\DiscoveryEngine\V1\CheckGroundingResponse\Claim>|\Google\Protobuf\Internal\RepeatedField $claims + * Claim texts and citation info across all claims in the answer candidate. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\GroundedGenerationService::initOnce(); + parent::__construct($data); + } + + /** + * The support score for the input answer candidate. + * Higher the score, higher is the fraction of claims that are supported by + * the provided facts. This is always set when a response is returned. + * + * Generated from protobuf field optional float support_score = 1; + * @return float + */ + public function getSupportScore() + { + return isset($this->support_score) ? $this->support_score : 0.0; + } + + public function hasSupportScore() + { + return isset($this->support_score); + } + + public function clearSupportScore() + { + unset($this->support_score); + } + + /** + * The support score for the input answer candidate. + * Higher the score, higher is the fraction of claims that are supported by + * the provided facts. This is always set when a response is returned. + * + * Generated from protobuf field optional float support_score = 1; + * @param float $var + * @return $this + */ + public function setSupportScore($var) + { + GPBUtil::checkFloat($var); + $this->support_score = $var; + + return $this; + } + + /** + * List of facts cited across all claims in the answer candidate. + * These are derived from the facts supplied in the request. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.FactChunk cited_chunks = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCitedChunks() + { + return $this->cited_chunks; + } + + /** + * List of facts cited across all claims in the answer candidate. + * These are derived from the facts supplied in the request. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.FactChunk cited_chunks = 3; + * @param array<\Google\Cloud\DiscoveryEngine\V1\FactChunk>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCitedChunks($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\FactChunk::class); + $this->cited_chunks = $arr; + + return $this; + } + + /** + * Claim texts and citation info across all claims in the answer candidate. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim claims = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getClaims() + { + return $this->claims; + } + + /** + * Claim texts and citation info across all claims in the answer candidate. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim claims = 4; + * @param array<\Google\Cloud\DiscoveryEngine\V1\CheckGroundingResponse\Claim>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setClaims($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\CheckGroundingResponse\Claim::class); + $this->claims = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/CheckGroundingResponse/Claim.php b/DiscoveryEngine/src/V1/CheckGroundingResponse/Claim.php new file mode 100644 index 000000000000..fb621ee4eb30 --- /dev/null +++ b/DiscoveryEngine/src/V1/CheckGroundingResponse/Claim.php @@ -0,0 +1,290 @@ +google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim + */ +class Claim extends \Google\Protobuf\Internal\Message +{ + /** + * Position indicating the start of the claim in the answer candidate, + * measured in bytes. + * + * Generated from protobuf field optional int32 start_pos = 1; + */ + protected $start_pos = null; + /** + * Position indicating the end of the claim in the answer candidate, + * exclusive. + * + * Generated from protobuf field optional int32 end_pos = 2; + */ + protected $end_pos = null; + /** + * Text for the claim in the answer candidate. Always provided regardless of + * whether citations or anti-citations are found. + * + * Generated from protobuf field string claim_text = 3; + */ + protected $claim_text = ''; + /** + * A list of indices (into 'cited_chunks') specifying the citations + * associated with the claim. For instance [1,3,4] means that + * cited_chunks[1], cited_chunks[3], cited_chunks[4] are the facts cited + * supporting for the claim. A citation to a fact indicates that the claim + * is supported by the fact. + * + * Generated from protobuf field repeated int32 citation_indices = 4; + */ + private $citation_indices; + /** + * Indicates that this claim required grounding check. When the system + * decided this claim doesn't require attribution/grounding check, this + * field will be set to false. In that case, no grounding check was done for + * the claim and therefore + * [citation_indices][google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim.citation_indices], + * and + * [anti_citation_indices][google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim.anti_citation_indices] + * should not be returned. + * + * Generated from protobuf field optional bool grounding_check_required = 6; + */ + protected $grounding_check_required = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type int $start_pos + * Position indicating the start of the claim in the answer candidate, + * measured in bytes. + * @type int $end_pos + * Position indicating the end of the claim in the answer candidate, + * exclusive. + * @type string $claim_text + * Text for the claim in the answer candidate. Always provided regardless of + * whether citations or anti-citations are found. + * @type array|\Google\Protobuf\Internal\RepeatedField $citation_indices + * A list of indices (into 'cited_chunks') specifying the citations + * associated with the claim. For instance [1,3,4] means that + * cited_chunks[1], cited_chunks[3], cited_chunks[4] are the facts cited + * supporting for the claim. A citation to a fact indicates that the claim + * is supported by the fact. + * @type bool $grounding_check_required + * Indicates that this claim required grounding check. When the system + * decided this claim doesn't require attribution/grounding check, this + * field will be set to false. In that case, no grounding check was done for + * the claim and therefore + * [citation_indices][google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim.citation_indices], + * and + * [anti_citation_indices][google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim.anti_citation_indices] + * should not be returned. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\GroundedGenerationService::initOnce(); + parent::__construct($data); + } + + /** + * Position indicating the start of the claim in the answer candidate, + * measured in bytes. + * + * Generated from protobuf field optional int32 start_pos = 1; + * @return int + */ + public function getStartPos() + { + return isset($this->start_pos) ? $this->start_pos : 0; + } + + public function hasStartPos() + { + return isset($this->start_pos); + } + + public function clearStartPos() + { + unset($this->start_pos); + } + + /** + * Position indicating the start of the claim in the answer candidate, + * measured in bytes. + * + * Generated from protobuf field optional int32 start_pos = 1; + * @param int $var + * @return $this + */ + public function setStartPos($var) + { + GPBUtil::checkInt32($var); + $this->start_pos = $var; + + return $this; + } + + /** + * Position indicating the end of the claim in the answer candidate, + * exclusive. + * + * Generated from protobuf field optional int32 end_pos = 2; + * @return int + */ + public function getEndPos() + { + return isset($this->end_pos) ? $this->end_pos : 0; + } + + public function hasEndPos() + { + return isset($this->end_pos); + } + + public function clearEndPos() + { + unset($this->end_pos); + } + + /** + * Position indicating the end of the claim in the answer candidate, + * exclusive. + * + * Generated from protobuf field optional int32 end_pos = 2; + * @param int $var + * @return $this + */ + public function setEndPos($var) + { + GPBUtil::checkInt32($var); + $this->end_pos = $var; + + return $this; + } + + /** + * Text for the claim in the answer candidate. Always provided regardless of + * whether citations or anti-citations are found. + * + * Generated from protobuf field string claim_text = 3; + * @return string + */ + public function getClaimText() + { + return $this->claim_text; + } + + /** + * Text for the claim in the answer candidate. Always provided regardless of + * whether citations or anti-citations are found. + * + * Generated from protobuf field string claim_text = 3; + * @param string $var + * @return $this + */ + public function setClaimText($var) + { + GPBUtil::checkString($var, True); + $this->claim_text = $var; + + return $this; + } + + /** + * A list of indices (into 'cited_chunks') specifying the citations + * associated with the claim. For instance [1,3,4] means that + * cited_chunks[1], cited_chunks[3], cited_chunks[4] are the facts cited + * supporting for the claim. A citation to a fact indicates that the claim + * is supported by the fact. + * + * Generated from protobuf field repeated int32 citation_indices = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getCitationIndices() + { + return $this->citation_indices; + } + + /** + * A list of indices (into 'cited_chunks') specifying the citations + * associated with the claim. For instance [1,3,4] means that + * cited_chunks[1], cited_chunks[3], cited_chunks[4] are the facts cited + * supporting for the claim. A citation to a fact indicates that the claim + * is supported by the fact. + * + * Generated from protobuf field repeated int32 citation_indices = 4; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setCitationIndices($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::INT32); + $this->citation_indices = $arr; + + return $this; + } + + /** + * Indicates that this claim required grounding check. When the system + * decided this claim doesn't require attribution/grounding check, this + * field will be set to false. In that case, no grounding check was done for + * the claim and therefore + * [citation_indices][google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim.citation_indices], + * and + * [anti_citation_indices][google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim.anti_citation_indices] + * should not be returned. + * + * Generated from protobuf field optional bool grounding_check_required = 6; + * @return bool + */ + public function getGroundingCheckRequired() + { + return isset($this->grounding_check_required) ? $this->grounding_check_required : false; + } + + public function hasGroundingCheckRequired() + { + return isset($this->grounding_check_required); + } + + public function clearGroundingCheckRequired() + { + unset($this->grounding_check_required); + } + + /** + * Indicates that this claim required grounding check. When the system + * decided this claim doesn't require attribution/grounding check, this + * field will be set to false. In that case, no grounding check was done for + * the claim and therefore + * [citation_indices][google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim.citation_indices], + * and + * [anti_citation_indices][google.cloud.discoveryengine.v1.CheckGroundingResponse.Claim.anti_citation_indices] + * should not be returned. + * + * Generated from protobuf field optional bool grounding_check_required = 6; + * @param bool $var + * @return $this + */ + public function setGroundingCheckRequired($var) + { + GPBUtil::checkBool($var); + $this->grounding_check_required = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/CheckGroundingSpec.php b/DiscoveryEngine/src/V1/CheckGroundingSpec.php new file mode 100644 index 000000000000..87d16aeca1df --- /dev/null +++ b/DiscoveryEngine/src/V1/CheckGroundingSpec.php @@ -0,0 +1,93 @@ +google.cloud.discoveryengine.v1.CheckGroundingSpec + */ +class CheckGroundingSpec extends \Google\Protobuf\Internal\Message +{ + /** + * The threshold (in [0,1]) used for determining whether a fact must be + * cited for a claim in the answer candidate. Choosing a higher threshold + * will lead to fewer but very strong citations, while choosing a lower + * threshold may lead to more but somewhat weaker citations. If unset, the + * threshold will default to 0.6. + * + * Generated from protobuf field optional double citation_threshold = 1; + */ + protected $citation_threshold = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $citation_threshold + * The threshold (in [0,1]) used for determining whether a fact must be + * cited for a claim in the answer candidate. Choosing a higher threshold + * will lead to fewer but very strong citations, while choosing a lower + * threshold may lead to more but somewhat weaker citations. If unset, the + * threshold will default to 0.6. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\GroundedGenerationService::initOnce(); + parent::__construct($data); + } + + /** + * The threshold (in [0,1]) used for determining whether a fact must be + * cited for a claim in the answer candidate. Choosing a higher threshold + * will lead to fewer but very strong citations, while choosing a lower + * threshold may lead to more but somewhat weaker citations. If unset, the + * threshold will default to 0.6. + * + * Generated from protobuf field optional double citation_threshold = 1; + * @return float + */ + public function getCitationThreshold() + { + return isset($this->citation_threshold) ? $this->citation_threshold : 0.0; + } + + public function hasCitationThreshold() + { + return isset($this->citation_threshold); + } + + public function clearCitationThreshold() + { + unset($this->citation_threshold); + } + + /** + * The threshold (in [0,1]) used for determining whether a fact must be + * cited for a claim in the answer candidate. Choosing a higher threshold + * will lead to fewer but very strong citations, while choosing a lower + * threshold may lead to more but somewhat weaker citations. If unset, the + * threshold will default to 0.6. + * + * Generated from protobuf field optional double citation_threshold = 1; + * @param float $var + * @return $this + */ + public function setCitationThreshold($var) + { + GPBUtil::checkDouble($var); + $this->citation_threshold = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/Client/CompletionServiceClient.php b/DiscoveryEngine/src/V1/Client/CompletionServiceClient.php index 575d4c8d8424..8f1d678a1b75 100644 --- a/DiscoveryEngine/src/V1/Client/CompletionServiceClient.php +++ b/DiscoveryEngine/src/V1/Client/CompletionServiceClient.php @@ -27,7 +27,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\ResourceHelperTrait; use Google\ApiCore\RetrySettings; @@ -38,6 +37,7 @@ use Google\Cloud\DiscoveryEngine\V1\CompleteQueryResponse; use Google\Cloud\DiscoveryEngine\V1\ImportSuggestionDenyListEntriesRequest; use Google\Cloud\DiscoveryEngine\V1\PurgeSuggestionDenyListEntriesRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -135,6 +135,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a data_store * resource. diff --git a/DiscoveryEngine/src/V1/Client/ControlServiceClient.php b/DiscoveryEngine/src/V1/Client/ControlServiceClient.php new file mode 100644 index 000000000000..d523e97742e3 --- /dev/null +++ b/DiscoveryEngine/src/V1/Client/ControlServiceClient.php @@ -0,0 +1,538 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/control_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/control_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/control_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/control_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a control + * resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * @param string $control + * + * @return string The formatted control resource. + */ + public static function controlName(string $project, string $location, string $dataStore, string $control): string + { + return self::getPathTemplate('control')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + 'control' => $control, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a data_store + * resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted data_store resource. + */ + public static function dataStoreName(string $project, string $location, string $dataStore): string + { + return self::getPathTemplate('dataStore')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a engine + * resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $engine + * + * @return string The formatted engine resource. + */ + public static function engineName(string $project, string $location, string $collection, string $engine): string + { + return self::getPathTemplate('engine')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'engine' => $engine, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * + * @return string The formatted project_location_collection_data_store resource. + */ + public static function projectLocationCollectionDataStoreName( + string $project, + string $location, + string $collection, + string $dataStore + ): string { + return self::getPathTemplate('projectLocationCollectionDataStore')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store_control resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * @param string $control + * + * @return string The formatted project_location_collection_data_store_control resource. + */ + public static function projectLocationCollectionDataStoreControlName( + string $project, + string $location, + string $collection, + string $dataStore, + string $control + ): string { + return self::getPathTemplate('projectLocationCollectionDataStoreControl')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + 'control' => $control, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_engine_control resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $engine + * @param string $control + * + * @return string The formatted project_location_collection_engine_control resource. + */ + public static function projectLocationCollectionEngineControlName( + string $project, + string $location, + string $collection, + string $engine, + string $control + ): string { + return self::getPathTemplate('projectLocationCollectionEngineControl')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'engine' => $engine, + 'control' => $control, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted project_location_data_store resource. + */ + public static function projectLocationDataStoreName(string $project, string $location, string $dataStore): string + { + return self::getPathTemplate('projectLocationDataStore')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store_control resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * @param string $control + * + * @return string The formatted project_location_data_store_control resource. + */ + public static function projectLocationDataStoreControlName( + string $project, + string $location, + string $dataStore, + string $control + ): string { + return self::getPathTemplate('projectLocationDataStoreControl')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + 'control' => $control, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - control: projects/{project}/locations/{location}/dataStores/{data_store}/controls/{control} + * - dataStore: projects/{project}/locations/{location}/dataStores/{data_store} + * - engine: projects/{project}/locations/{location}/collections/{collection}/engines/{engine} + * - projectLocationCollectionDataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} + * - projectLocationCollectionDataStoreControl: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/controls/{control} + * - projectLocationCollectionEngineControl: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/controls/{control} + * - projectLocationDataStore: projects/{project}/locations/{location}/dataStores/{data_store} + * - projectLocationDataStoreControl: projects/{project}/locations/{location}/dataStores/{data_store}/controls/{control} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'discoveryengine.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a Control. + * + * By default 1000 controls are allowed for a data store. + * A request can be submitted to adjust this limit. + * If the [Control][google.cloud.discoveryengine.v1.Control] to create already + * exists, an ALREADY_EXISTS error is returned. + * + * The async variant is {@see ControlServiceClient::createControlAsync()} . + * + * @example samples/V1/ControlServiceClient/create_control.php + * + * @param CreateControlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Control + * + * @throws ApiException Thrown if the API call fails. + */ + public function createControl(CreateControlRequest $request, array $callOptions = []): Control + { + return $this->startApiCall('CreateControl', $request, $callOptions)->wait(); + } + + /** + * Deletes a Control. + * + * If the [Control][google.cloud.discoveryengine.v1.Control] to delete does + * not exist, a NOT_FOUND error is returned. + * + * The async variant is {@see ControlServiceClient::deleteControlAsync()} . + * + * @example samples/V1/ControlServiceClient/delete_control.php + * + * @param DeleteControlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteControl(DeleteControlRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteControl', $request, $callOptions)->wait(); + } + + /** + * Gets a Control. + * + * The async variant is {@see ControlServiceClient::getControlAsync()} . + * + * @example samples/V1/ControlServiceClient/get_control.php + * + * @param GetControlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Control + * + * @throws ApiException Thrown if the API call fails. + */ + public function getControl(GetControlRequest $request, array $callOptions = []): Control + { + return $this->startApiCall('GetControl', $request, $callOptions)->wait(); + } + + /** + * Lists all Controls by their parent + * [DataStore][google.cloud.discoveryengine.v1.DataStore]. + * + * The async variant is {@see ControlServiceClient::listControlsAsync()} . + * + * @example samples/V1/ControlServiceClient/list_controls.php + * + * @param ListControlsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listControls(ListControlsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListControls', $request, $callOptions); + } + + /** + * Updates a Control. + * + * [Control][google.cloud.discoveryengine.v1.Control] action type cannot be + * changed. If the [Control][google.cloud.discoveryengine.v1.Control] to + * update does not exist, a NOT_FOUND error is returned. + * + * The async variant is {@see ControlServiceClient::updateControlAsync()} . + * + * @example samples/V1/ControlServiceClient/update_control.php + * + * @param UpdateControlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Control + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateControl(UpdateControlRequest $request, array $callOptions = []): Control + { + return $this->startApiCall('UpdateControl', $request, $callOptions)->wait(); + } +} diff --git a/DiscoveryEngine/src/V1/Client/ConversationalSearchServiceClient.php b/DiscoveryEngine/src/V1/Client/ConversationalSearchServiceClient.php index 7e31a11b56ec..f46a96a4c66d 100644 --- a/DiscoveryEngine/src/V1/Client/ConversationalSearchServiceClient.php +++ b/DiscoveryEngine/src/V1/Client/ConversationalSearchServiceClient.php @@ -33,14 +33,24 @@ use Google\ApiCore\Transport\TransportInterface; use Google\ApiCore\ValidationException; use Google\Auth\FetchAuthTokenInterface; +use Google\Cloud\DiscoveryEngine\V1\Answer; +use Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest; +use Google\Cloud\DiscoveryEngine\V1\AnswerQueryResponse; use Google\Cloud\DiscoveryEngine\V1\Conversation; use Google\Cloud\DiscoveryEngine\V1\ConverseConversationRequest; use Google\Cloud\DiscoveryEngine\V1\ConverseConversationResponse; use Google\Cloud\DiscoveryEngine\V1\CreateConversationRequest; +use Google\Cloud\DiscoveryEngine\V1\CreateSessionRequest; use Google\Cloud\DiscoveryEngine\V1\DeleteConversationRequest; +use Google\Cloud\DiscoveryEngine\V1\DeleteSessionRequest; +use Google\Cloud\DiscoveryEngine\V1\GetAnswerRequest; use Google\Cloud\DiscoveryEngine\V1\GetConversationRequest; +use Google\Cloud\DiscoveryEngine\V1\GetSessionRequest; use Google\Cloud\DiscoveryEngine\V1\ListConversationsRequest; +use Google\Cloud\DiscoveryEngine\V1\ListSessionsRequest; +use Google\Cloud\DiscoveryEngine\V1\Session; use Google\Cloud\DiscoveryEngine\V1\UpdateConversationRequest; +use Google\Cloud\DiscoveryEngine\V1\UpdateSessionRequest; use GuzzleHttp\Promise\PromiseInterface; /** @@ -54,12 +64,19 @@ * name, and additionally a parseName method to extract the individual identifiers * contained within formatted names that are returned by the API. * + * @method PromiseInterface answerQueryAsync(AnswerQueryRequest $request, array $optionalArgs = []) * @method PromiseInterface converseConversationAsync(ConverseConversationRequest $request, array $optionalArgs = []) * @method PromiseInterface createConversationAsync(CreateConversationRequest $request, array $optionalArgs = []) + * @method PromiseInterface createSessionAsync(CreateSessionRequest $request, array $optionalArgs = []) * @method PromiseInterface deleteConversationAsync(DeleteConversationRequest $request, array $optionalArgs = []) + * @method PromiseInterface deleteSessionAsync(DeleteSessionRequest $request, array $optionalArgs = []) + * @method PromiseInterface getAnswerAsync(GetAnswerRequest $request, array $optionalArgs = []) * @method PromiseInterface getConversationAsync(GetConversationRequest $request, array $optionalArgs = []) + * @method PromiseInterface getSessionAsync(GetSessionRequest $request, array $optionalArgs = []) * @method PromiseInterface listConversationsAsync(ListConversationsRequest $request, array $optionalArgs = []) + * @method PromiseInterface listSessionsAsync(ListSessionsRequest $request, array $optionalArgs = []) * @method PromiseInterface updateConversationAsync(UpdateConversationRequest $request, array $optionalArgs = []) + * @method PromiseInterface updateSessionAsync(UpdateSessionRequest $request, array $optionalArgs = []) */ final class ConversationalSearchServiceClient { @@ -108,6 +125,65 @@ private static function getClientDefaults() ]; } + /** + * Formats a string containing the fully-qualified path to represent a answer + * resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * @param string $session + * @param string $answer + * + * @return string The formatted answer resource. + */ + public static function answerName( + string $project, + string $location, + string $dataStore, + string $session, + string $answer + ): string { + return self::getPathTemplate('answer')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + 'session' => $session, + 'answer' => $answer, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a chunk + * resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * @param string $branch + * @param string $document + * @param string $chunk + * + * @return string The formatted chunk resource. + */ + public static function chunkName( + string $project, + string $location, + string $dataStore, + string $branch, + string $document, + string $chunk + ): string { + return self::getPathTemplate('chunk')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + 'branch' => $branch, + 'document' => $document, + 'chunk' => $chunk, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a conversation * resource. @@ -236,6 +312,40 @@ public static function projectLocationCollectionDataStoreBranchDocumentName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store_branch_document_chunk resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * @param string $branch + * @param string $document + * @param string $chunk + * + * @return string The formatted project_location_collection_data_store_branch_document_chunk resource. + */ + public static function projectLocationCollectionDataStoreBranchDocumentChunkName( + string $project, + string $location, + string $collection, + string $dataStore, + string $branch, + string $document, + string $chunk + ): string { + return self::getPathTemplate('projectLocationCollectionDataStoreBranchDocumentChunk')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + 'branch' => $branch, + 'document' => $document, + 'chunk' => $chunk, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_collection_data_store_conversation resource. @@ -292,6 +402,65 @@ public static function projectLocationCollectionDataStoreServingConfigName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store_session resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * @param string $session + * + * @return string The formatted project_location_collection_data_store_session resource. + */ + public static function projectLocationCollectionDataStoreSessionName( + string $project, + string $location, + string $collection, + string $dataStore, + string $session + ): string { + return self::getPathTemplate('projectLocationCollectionDataStoreSession')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + 'session' => $session, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store_session_answer resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * @param string $session + * @param string $answer + * + * @return string The formatted project_location_collection_data_store_session_answer resource. + */ + public static function projectLocationCollectionDataStoreSessionAnswerName( + string $project, + string $location, + string $collection, + string $dataStore, + string $session, + string $answer + ): string { + return self::getPathTemplate('projectLocationCollectionDataStoreSessionAnswer')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + 'session' => $session, + 'answer' => $answer, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_collection_engine_conversation resource. @@ -348,6 +517,65 @@ public static function projectLocationCollectionEngineServingConfigName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_engine_session resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $engine + * @param string $session + * + * @return string The formatted project_location_collection_engine_session resource. + */ + public static function projectLocationCollectionEngineSessionName( + string $project, + string $location, + string $collection, + string $engine, + string $session + ): string { + return self::getPathTemplate('projectLocationCollectionEngineSession')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'engine' => $engine, + 'session' => $session, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_engine_session_answer resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $engine + * @param string $session + * @param string $answer + * + * @return string The formatted project_location_collection_engine_session_answer resource. + */ + public static function projectLocationCollectionEngineSessionAnswerName( + string $project, + string $location, + string $collection, + string $engine, + string $session, + string $answer + ): string { + return self::getPathTemplate('projectLocationCollectionEngineSessionAnswer')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'engine' => $engine, + 'session' => $session, + 'answer' => $answer, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_data_store resource. @@ -395,6 +623,37 @@ public static function projectLocationDataStoreBranchDocumentName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store_branch_document_chunk resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * @param string $branch + * @param string $document + * @param string $chunk + * + * @return string The formatted project_location_data_store_branch_document_chunk resource. + */ + public static function projectLocationDataStoreBranchDocumentChunkName( + string $project, + string $location, + string $dataStore, + string $branch, + string $document, + string $chunk + ): string { + return self::getPathTemplate('projectLocationDataStoreBranchDocumentChunk')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + 'branch' => $branch, + 'document' => $document, + 'chunk' => $chunk, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_data_store_conversation resource. @@ -445,6 +704,59 @@ public static function projectLocationDataStoreServingConfigName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store_session resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * @param string $session + * + * @return string The formatted project_location_data_store_session resource. + */ + public static function projectLocationDataStoreSessionName( + string $project, + string $location, + string $dataStore, + string $session + ): string { + return self::getPathTemplate('projectLocationDataStoreSession')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + 'session' => $session, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store_session_answer resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * @param string $session + * @param string $answer + * + * @return string The formatted project_location_data_store_session_answer resource. + */ + public static function projectLocationDataStoreSessionAnswerName( + string $project, + string $location, + string $dataStore, + string $session, + string $answer + ): string { + return self::getPathTemplate('projectLocationDataStoreSessionAnswer')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + 'session' => $session, + 'answer' => $answer, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * serving_config resource. @@ -470,24 +782,56 @@ public static function servingConfigName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a session + * resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * @param string $session + * + * @return string The formatted session resource. + */ + public static function sessionName(string $project, string $location, string $dataStore, string $session): string + { + return self::getPathTemplate('session')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + 'session' => $session, + ]); + } + /** * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern + * - answer: projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}/answers/{answer} + * - chunk: projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk} * - conversation: projects/{project}/locations/{location}/dataStores/{data_store}/conversations/{conversation} * - dataStore: projects/{project}/locations/{location}/dataStores/{data_store} * - document: projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document} * - projectLocationCollectionDataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} * - projectLocationCollectionDataStoreBranchDocument: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document} + * - projectLocationCollectionDataStoreBranchDocumentChunk: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk} * - projectLocationCollectionDataStoreConversation: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/conversations/{conversation} * - projectLocationCollectionDataStoreServingConfig: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config} + * - projectLocationCollectionDataStoreSession: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/sessions/{session} + * - projectLocationCollectionDataStoreSessionAnswer: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/sessions/{session}/answers/{answer} * - projectLocationCollectionEngineConversation: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/conversations/{conversation} * - projectLocationCollectionEngineServingConfig: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config} + * - projectLocationCollectionEngineSession: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session} + * - projectLocationCollectionEngineSessionAnswer: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}/answers/{answer} * - projectLocationDataStore: projects/{project}/locations/{location}/dataStores/{data_store} * - projectLocationDataStoreBranchDocument: projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document} + * - projectLocationDataStoreBranchDocumentChunk: projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk} * - projectLocationDataStoreConversation: projects/{project}/locations/{location}/dataStores/{data_store}/conversations/{conversation} * - projectLocationDataStoreServingConfig: projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config} + * - projectLocationDataStoreSession: projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session} + * - projectLocationDataStoreSessionAnswer: projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}/answers/{answer} * - servingConfig: projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config} + * - session: projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session} * * The optional $template argument can be supplied to specify a particular pattern, * and must match one of the templates listed above. If no $template argument is @@ -578,6 +922,33 @@ public function __call($method, $args) return call_user_func_array([$this, 'startAsyncCall'], $args); } + /** + * Answer query method. + * + * The async variant is + * {@see ConversationalSearchServiceClient::answerQueryAsync()} . + * + * @example samples/V1/ConversationalSearchServiceClient/answer_query.php + * + * @param AnswerQueryRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return AnswerQueryResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function answerQuery(AnswerQueryRequest $request, array $callOptions = []): AnswerQueryResponse + { + return $this->startApiCall('AnswerQuery', $request, $callOptions)->wait(); + } + /** * Converses a conversation. * @@ -637,6 +1008,36 @@ public function createConversation(CreateConversationRequest $request, array $ca return $this->startApiCall('CreateConversation', $request, $callOptions)->wait(); } + /** + * Creates a Session. + * + * If the [Session][google.cloud.discoveryengine.v1.Session] to create already + * exists, an ALREADY_EXISTS error is returned. + * + * The async variant is + * {@see ConversationalSearchServiceClient::createSessionAsync()} . + * + * @example samples/V1/ConversationalSearchServiceClient/create_session.php + * + * @param CreateSessionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Session + * + * @throws ApiException Thrown if the API call fails. + */ + public function createSession(CreateSessionRequest $request, array $callOptions = []): Session + { + return $this->startApiCall('CreateSession', $request, $callOptions)->wait(); + } + /** * Deletes a Conversation. * @@ -665,6 +1066,61 @@ public function deleteConversation(DeleteConversationRequest $request, array $ca $this->startApiCall('DeleteConversation', $request, $callOptions)->wait(); } + /** + * Deletes a Session. + * + * If the [Session][google.cloud.discoveryengine.v1.Session] to delete does + * not exist, a NOT_FOUND error is returned. + * + * The async variant is + * {@see ConversationalSearchServiceClient::deleteSessionAsync()} . + * + * @example samples/V1/ConversationalSearchServiceClient/delete_session.php + * + * @param DeleteSessionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + */ + public function deleteSession(DeleteSessionRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteSession', $request, $callOptions)->wait(); + } + + /** + * Gets a Answer. + * + * The async variant is {@see ConversationalSearchServiceClient::getAnswerAsync()} + * . + * + * @example samples/V1/ConversationalSearchServiceClient/get_answer.php + * + * @param GetAnswerRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Answer + * + * @throws ApiException Thrown if the API call fails. + */ + public function getAnswer(GetAnswerRequest $request, array $callOptions = []): Answer + { + return $this->startApiCall('GetAnswer', $request, $callOptions)->wait(); + } + /** * Gets a Conversation. * @@ -692,6 +1148,33 @@ public function getConversation(GetConversationRequest $request, array $callOpti return $this->startApiCall('GetConversation', $request, $callOptions)->wait(); } + /** + * Gets a Session. + * + * The async variant is {@see ConversationalSearchServiceClient::getSessionAsync()} + * . + * + * @example samples/V1/ConversationalSearchServiceClient/get_session.php + * + * @param GetSessionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Session + * + * @throws ApiException Thrown if the API call fails. + */ + public function getSession(GetSessionRequest $request, array $callOptions = []): Session + { + return $this->startApiCall('GetSession', $request, $callOptions)->wait(); + } + /** * Lists all Conversations by their parent * [DataStore][google.cloud.discoveryengine.v1.DataStore]. @@ -720,6 +1203,34 @@ public function listConversations(ListConversationsRequest $request, array $call return $this->startApiCall('ListConversations', $request, $callOptions); } + /** + * Lists all Sessions by their parent + * [DataStore][google.cloud.discoveryengine.v1.DataStore]. + * + * The async variant is + * {@see ConversationalSearchServiceClient::listSessionsAsync()} . + * + * @example samples/V1/ConversationalSearchServiceClient/list_sessions.php + * + * @param ListSessionsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function listSessions(ListSessionsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListSessions', $request, $callOptions); + } + /** * Updates a Conversation. * @@ -751,4 +1262,35 @@ public function updateConversation(UpdateConversationRequest $request, array $ca { return $this->startApiCall('UpdateConversation', $request, $callOptions)->wait(); } + + /** + * Updates a Session. + * + * [Session][google.cloud.discoveryengine.v1.Session] action type cannot be + * changed. If the [Session][google.cloud.discoveryengine.v1.Session] to + * update does not exist, a NOT_FOUND error is returned. + * + * The async variant is + * {@see ConversationalSearchServiceClient::updateSessionAsync()} . + * + * @example samples/V1/ConversationalSearchServiceClient/update_session.php + * + * @param UpdateSessionRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Session + * + * @throws ApiException Thrown if the API call fails. + */ + public function updateSession(UpdateSessionRequest $request, array $callOptions = []): Session + { + return $this->startApiCall('UpdateSession', $request, $callOptions)->wait(); + } } diff --git a/DiscoveryEngine/src/V1/Client/DataStoreServiceClient.php b/DiscoveryEngine/src/V1/Client/DataStoreServiceClient.php index 0b53c5d90acf..6009714e4cee 100644 --- a/DiscoveryEngine/src/V1/Client/DataStoreServiceClient.php +++ b/DiscoveryEngine/src/V1/Client/DataStoreServiceClient.php @@ -27,7 +27,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -41,6 +40,7 @@ use Google\Cloud\DiscoveryEngine\V1\GetDataStoreRequest; use Google\Cloud\DiscoveryEngine\V1\ListDataStoresRequest; use Google\Cloud\DiscoveryEngine\V1\UpdateDataStoreRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -141,6 +141,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a collection * resource. @@ -179,6 +198,25 @@ public static function dataStoreName(string $project, string $location, string $ ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * document_processing_config resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted document_processing_config resource. + */ + public static function documentProcessingConfigName(string $project, string $location, string $dataStore): string + { + return self::getPathTemplate('documentProcessingConfig')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_collection_data_store resource. @@ -204,6 +242,31 @@ public static function projectLocationCollectionDataStoreName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store_documentProcessingConfig resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * + * @return string The formatted project_location_collection_data_store_documentProcessingConfig resource. + */ + public static function projectLocationCollectionDataStoreDocumentProcessingConfigName( + string $project, + string $location, + string $collection, + string $dataStore + ): string { + return self::getPathTemplate('projectLocationCollectionDataStoreDocumentProcessingConfig')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_collection_data_store_schema resource. @@ -251,6 +314,28 @@ public static function projectLocationDataStoreName(string $project, string $loc ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store_documentProcessingConfig resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted project_location_data_store_documentProcessingConfig resource. + */ + public static function projectLocationDataStoreDocumentProcessingConfigName( + string $project, + string $location, + string $dataStore + ): string { + return self::getPathTemplate('projectLocationDataStoreDocumentProcessingConfig')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_data_store_schema resource. @@ -303,9 +388,12 @@ public static function schemaName(string $project, string $location, string $dat * Template: Pattern * - collection: projects/{project}/locations/{location}/collections/{collection} * - dataStore: projects/{project}/locations/{location}/dataStores/{data_store} + * - documentProcessingConfig: projects/{project}/locations/{location}/dataStores/{data_store}/documentProcessingConfig * - projectLocationCollectionDataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} + * - projectLocationCollectionDataStoreDocumentProcessingConfig: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/documentProcessingConfig * - projectLocationCollectionDataStoreSchema: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema} * - projectLocationDataStore: projects/{project}/locations/{location}/dataStores/{data_store} + * - projectLocationDataStoreDocumentProcessingConfig: projects/{project}/locations/{location}/dataStores/{data_store}/documentProcessingConfig * - projectLocationDataStoreSchema: projects/{project}/locations/{location}/dataStores/{data_store}/schemas/{schema} * - schema: projects/{project}/locations/{location}/dataStores/{data_store}/schemas/{schema} * diff --git a/DiscoveryEngine/src/V1/Client/DocumentServiceClient.php b/DiscoveryEngine/src/V1/Client/DocumentServiceClient.php index 258c76aaa53d..2e68356ee697 100644 --- a/DiscoveryEngine/src/V1/Client/DocumentServiceClient.php +++ b/DiscoveryEngine/src/V1/Client/DocumentServiceClient.php @@ -27,7 +27,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -43,6 +42,7 @@ use Google\Cloud\DiscoveryEngine\V1\ListDocumentsRequest; use Google\Cloud\DiscoveryEngine\V1\PurgeDocumentsRequest; use Google\Cloud\DiscoveryEngine\V1\UpdateDocumentRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -145,6 +145,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a branch * resource. @@ -508,7 +527,7 @@ public function getDocument(GetDocumentRequest $request, array $callOptions = [] /** * Bulk import of multiple * [Document][google.cloud.discoveryengine.v1.Document]s. Request processing - * may be synchronous. Non-existing items will be created. + * may be synchronous. Non-existing items are created. * * Note: It is possible for a subset of the * [Document][google.cloud.discoveryengine.v1.Document]s to be successfully diff --git a/DiscoveryEngine/src/V1/Client/EngineServiceClient.php b/DiscoveryEngine/src/V1/Client/EngineServiceClient.php index 425030aeca11..990f2790f9ea 100644 --- a/DiscoveryEngine/src/V1/Client/EngineServiceClient.php +++ b/DiscoveryEngine/src/V1/Client/EngineServiceClient.php @@ -27,7 +27,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -41,6 +40,7 @@ use Google\Cloud\DiscoveryEngine\V1\GetEngineRequest; use Google\Cloud\DiscoveryEngine\V1\ListEnginesRequest; use Google\Cloud\DiscoveryEngine\V1\UpdateEngineRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -141,6 +141,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a collection * resource. diff --git a/DiscoveryEngine/src/V1/Client/GroundedGenerationServiceClient.php b/DiscoveryEngine/src/V1/Client/GroundedGenerationServiceClient.php new file mode 100644 index 000000000000..85d09fe3c447 --- /dev/null +++ b/DiscoveryEngine/src/V1/Client/GroundedGenerationServiceClient.php @@ -0,0 +1,239 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/grounded_generation_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/grounded_generation_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/grounded_generation_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => + __DIR__ . '/../resources/grounded_generation_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * grounding_config resource. + * + * @param string $project + * @param string $location + * @param string $groundingConfig + * + * @return string The formatted grounding_config resource. + */ + public static function groundingConfigName(string $project, string $location, string $groundingConfig): string + { + return self::getPathTemplate('groundingConfig')->render([ + 'project' => $project, + 'location' => $location, + 'grounding_config' => $groundingConfig, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - groundingConfig: projects/{project}/locations/{location}/groundingConfigs/{grounding_config} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'discoveryengine.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Performs a grounding check. + * + * The async variant is + * {@see GroundedGenerationServiceClient::checkGroundingAsync()} . + * + * @example samples/V1/GroundedGenerationServiceClient/check_grounding.php + * + * @param CheckGroundingRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return CheckGroundingResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function checkGrounding(CheckGroundingRequest $request, array $callOptions = []): CheckGroundingResponse + { + return $this->startApiCall('CheckGrounding', $request, $callOptions)->wait(); + } +} diff --git a/DiscoveryEngine/src/V1/Client/ProjectServiceClient.php b/DiscoveryEngine/src/V1/Client/ProjectServiceClient.php new file mode 100644 index 000000000000..823048011f72 --- /dev/null +++ b/DiscoveryEngine/src/V1/Client/ProjectServiceClient.php @@ -0,0 +1,295 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/project_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/project_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/project_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/project_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'discoveryengine.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Provisions the project resource. During the + * process, related systems will get prepared and initialized. + * + * Caller must read the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms), and optionally + * specify in request to provide consent to that service terms. + * + * The async variant is {@see ProjectServiceClient::provisionProjectAsync()} . + * + * @example samples/V1/ProjectServiceClient/provision_project.php + * + * @param ProvisionProjectRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function provisionProject(ProvisionProjectRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ProvisionProject', $request, $callOptions)->wait(); + } +} diff --git a/DiscoveryEngine/src/V1/Client/RankServiceClient.php b/DiscoveryEngine/src/V1/Client/RankServiceClient.php new file mode 100644 index 000000000000..c6e880be9f01 --- /dev/null +++ b/DiscoveryEngine/src/V1/Client/RankServiceClient.php @@ -0,0 +1,237 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/rank_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/rank_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/rank_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/rank_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a + * ranking_config resource. + * + * @param string $project + * @param string $location + * @param string $rankingConfig + * + * @return string The formatted ranking_config resource. + */ + public static function rankingConfigName(string $project, string $location, string $rankingConfig): string + { + return self::getPathTemplate('rankingConfig')->render([ + 'project' => $project, + 'location' => $location, + 'ranking_config' => $rankingConfig, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - rankingConfig: projects/{project}/locations/{location}/rankingConfigs/{ranking_config} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'discoveryengine.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Ranks a list of text records based on the given input query. + * + * The async variant is {@see RankServiceClient::rankAsync()} . + * + * @example samples/V1/RankServiceClient/rank.php + * + * @param RankRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return RankResponse + * + * @throws ApiException Thrown if the API call fails. + */ + public function rank(RankRequest $request, array $callOptions = []): RankResponse + { + return $this->startApiCall('Rank', $request, $callOptions)->wait(); + } +} diff --git a/DiscoveryEngine/src/V1/Client/RecommendationServiceClient.php b/DiscoveryEngine/src/V1/Client/RecommendationServiceClient.php index 08cff979e4c7..463a8cf4b7ca 100644 --- a/DiscoveryEngine/src/V1/Client/RecommendationServiceClient.php +++ b/DiscoveryEngine/src/V1/Client/RecommendationServiceClient.php @@ -95,6 +95,25 @@ private static function getClientDefaults() ]; } + /** + * Formats a string containing the fully-qualified path to represent a data_store + * resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted data_store resource. + */ + public static function dataStoreName(string $project, string $location, string $dataStore): string + { + return self::getPathTemplate('dataStore')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a document * resource. @@ -123,6 +142,52 @@ public static function documentName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a engine + * resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $engine + * + * @return string The formatted engine resource. + */ + public static function engineName(string $project, string $location, string $collection, string $engine): string + { + return self::getPathTemplate('engine')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'engine' => $engine, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * + * @return string The formatted project_location_collection_data_store resource. + */ + public static function projectLocationCollectionDataStoreName( + string $project, + string $location, + string $collection, + string $dataStore + ): string { + return self::getPathTemplate('projectLocationCollectionDataStore')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_collection_data_store_branch_document resource. @@ -210,6 +275,25 @@ public static function projectLocationCollectionEngineServingConfigName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted project_location_data_store resource. + */ + public static function projectLocationDataStoreName(string $project, string $location, string $dataStore): string + { + return self::getPathTemplate('projectLocationDataStore')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_data_store_branch_document resource. @@ -292,10 +376,14 @@ public static function servingConfigName( * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern + * - dataStore: projects/{project}/locations/{location}/dataStores/{data_store} * - document: projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document} + * - engine: projects/{project}/locations/{location}/collections/{collection}/engines/{engine} + * - projectLocationCollectionDataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} * - projectLocationCollectionDataStoreBranchDocument: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document} * - projectLocationCollectionDataStoreServingConfig: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config} * - projectLocationCollectionEngineServingConfig: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config} + * - projectLocationDataStore: projects/{project}/locations/{location}/dataStores/{data_store} * - projectLocationDataStoreBranchDocument: projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document} * - projectLocationDataStoreServingConfig: projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config} * - servingConfig: projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config} diff --git a/DiscoveryEngine/src/V1/Client/SchemaServiceClient.php b/DiscoveryEngine/src/V1/Client/SchemaServiceClient.php index 429a2e82a6c8..50450a57322d 100644 --- a/DiscoveryEngine/src/V1/Client/SchemaServiceClient.php +++ b/DiscoveryEngine/src/V1/Client/SchemaServiceClient.php @@ -27,7 +27,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -41,6 +40,7 @@ use Google\Cloud\DiscoveryEngine\V1\ListSchemasRequest; use Google\Cloud\DiscoveryEngine\V1\Schema; use Google\Cloud\DiscoveryEngine\V1\UpdateSchemaRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -140,6 +140,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a data_store * resource. diff --git a/DiscoveryEngine/src/V1/Client/SiteSearchEngineServiceClient.php b/DiscoveryEngine/src/V1/Client/SiteSearchEngineServiceClient.php index 4f4fabada7bb..8352c0540ac4 100644 --- a/DiscoveryEngine/src/V1/Client/SiteSearchEngineServiceClient.php +++ b/DiscoveryEngine/src/V1/Client/SiteSearchEngineServiceClient.php @@ -27,7 +27,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -49,6 +48,7 @@ use Google\Cloud\DiscoveryEngine\V1\SiteSearchEngine; use Google\Cloud\DiscoveryEngine\V1\TargetSite; use Google\Cloud\DiscoveryEngine\V1\UpdateTargetSiteRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -156,6 +156,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_collection_data_store_siteSearchEngine resource. diff --git a/DiscoveryEngine/src/V1/Client/UserEventServiceClient.php b/DiscoveryEngine/src/V1/Client/UserEventServiceClient.php index dabde3b727ca..cdb8e6d36f83 100644 --- a/DiscoveryEngine/src/V1/Client/UserEventServiceClient.php +++ b/DiscoveryEngine/src/V1/Client/UserEventServiceClient.php @@ -27,7 +27,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\ResourceHelperTrait; use Google\ApiCore\RetrySettings; @@ -39,6 +38,7 @@ use Google\Cloud\DiscoveryEngine\V1\ImportUserEventsRequest; use Google\Cloud\DiscoveryEngine\V1\UserEvent; use Google\Cloud\DiscoveryEngine\V1\WriteUserEventRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -136,6 +136,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a data_store * resource. @@ -183,6 +202,27 @@ public static function documentName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a engine + * resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $engine + * + * @return string The formatted engine resource. + */ + public static function engineName(string $project, string $location, string $collection, string $engine): string + { + return self::getPathTemplate('engine')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'engine' => $engine, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_collection_data_store resource. @@ -292,6 +332,7 @@ public static function projectLocationDataStoreBranchDocumentName( * Template: Pattern * - dataStore: projects/{project}/locations/{location}/dataStores/{data_store} * - document: projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document} + * - engine: projects/{project}/locations/{location}/collections/{collection}/engines/{engine} * - projectLocationCollectionDataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} * - projectLocationCollectionDataStoreBranchDocument: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document} * - projectLocationDataStore: projects/{project}/locations/{location}/dataStores/{data_store} @@ -418,7 +459,7 @@ public function collectUserEvent(CollectUserEventRequest $request, array $callOp } /** - * Bulk import of User events. Request processing might be + * Bulk import of user events. Request processing might be * synchronous. Events that already exist are skipped. * Use this method for backfilling historical user events. * diff --git a/DiscoveryEngine/src/V1/Condition.php b/DiscoveryEngine/src/V1/Condition.php new file mode 100644 index 000000000000..acaf131b3572 --- /dev/null +++ b/DiscoveryEngine/src/V1/Condition.php @@ -0,0 +1,113 @@ +google.cloud.discoveryengine.v1.Condition + */ +class Condition extends \Google\Protobuf\Internal\Message +{ + /** + * Search only + * A list of terms to match the query on. + * Maximum of 10 query terms. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Condition.QueryTerm query_terms = 2; + */ + private $query_terms; + /** + * Range of time(s) specifying when condition is active. + * Maximum of 10 time ranges. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Condition.TimeRange active_time_range = 3; + */ + private $active_time_range; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DiscoveryEngine\V1\Condition\QueryTerm>|\Google\Protobuf\Internal\RepeatedField $query_terms + * Search only + * A list of terms to match the query on. + * Maximum of 10 query terms. + * @type array<\Google\Cloud\DiscoveryEngine\V1\Condition\TimeRange>|\Google\Protobuf\Internal\RepeatedField $active_time_range + * Range of time(s) specifying when condition is active. + * Maximum of 10 time ranges. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Control::initOnce(); + parent::__construct($data); + } + + /** + * Search only + * A list of terms to match the query on. + * Maximum of 10 query terms. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Condition.QueryTerm query_terms = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getQueryTerms() + { + return $this->query_terms; + } + + /** + * Search only + * A list of terms to match the query on. + * Maximum of 10 query terms. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Condition.QueryTerm query_terms = 2; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Condition\QueryTerm>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setQueryTerms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Condition\QueryTerm::class); + $this->query_terms = $arr; + + return $this; + } + + /** + * Range of time(s) specifying when condition is active. + * Maximum of 10 time ranges. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Condition.TimeRange active_time_range = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getActiveTimeRange() + { + return $this->active_time_range; + } + + /** + * Range of time(s) specifying when condition is active. + * Maximum of 10 time ranges. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Condition.TimeRange active_time_range = 3; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Condition\TimeRange>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setActiveTimeRange($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Condition\TimeRange::class); + $this->active_time_range = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/Condition/QueryTerm.php b/DiscoveryEngine/src/V1/Condition/QueryTerm.php new file mode 100644 index 000000000000..9f24b0dc4f61 --- /dev/null +++ b/DiscoveryEngine/src/V1/Condition/QueryTerm.php @@ -0,0 +1,118 @@ +google.cloud.discoveryengine.v1.Condition.QueryTerm + */ +class QueryTerm extends \Google\Protobuf\Internal\Message +{ + /** + * The specific query value to match against + * Must be lowercase, must be UTF-8. + * Can have at most 3 space separated terms if full_match is true. + * Cannot be an empty string. + * Maximum length of 5000 characters. + * + * Generated from protobuf field string value = 1; + */ + protected $value = ''; + /** + * Whether the search query needs to exactly match the query term. + * + * Generated from protobuf field bool full_match = 2; + */ + protected $full_match = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $value + * The specific query value to match against + * Must be lowercase, must be UTF-8. + * Can have at most 3 space separated terms if full_match is true. + * Cannot be an empty string. + * Maximum length of 5000 characters. + * @type bool $full_match + * Whether the search query needs to exactly match the query term. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Control::initOnce(); + parent::__construct($data); + } + + /** + * The specific query value to match against + * Must be lowercase, must be UTF-8. + * Can have at most 3 space separated terms if full_match is true. + * Cannot be an empty string. + * Maximum length of 5000 characters. + * + * Generated from protobuf field string value = 1; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The specific query value to match against + * Must be lowercase, must be UTF-8. + * Can have at most 3 space separated terms if full_match is true. + * Cannot be an empty string. + * Maximum length of 5000 characters. + * + * Generated from protobuf field string value = 1; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * Whether the search query needs to exactly match the query term. + * + * Generated from protobuf field bool full_match = 2; + * @return bool + */ + public function getFullMatch() + { + return $this->full_match; + } + + /** + * Whether the search query needs to exactly match the query term. + * + * Generated from protobuf field bool full_match = 2; + * @param bool $var + * @return $this + */ + public function setFullMatch($var) + { + GPBUtil::checkBool($var); + $this->full_match = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Condition/TimeRange.php b/DiscoveryEngine/src/V1/Condition/TimeRange.php new file mode 100644 index 000000000000..bdff1cde4c2e --- /dev/null +++ b/DiscoveryEngine/src/V1/Condition/TimeRange.php @@ -0,0 +1,134 @@ +google.cloud.discoveryengine.v1.Condition.TimeRange + */ +class TimeRange extends \Google\Protobuf\Internal\Message +{ + /** + * Start of time range. + * Range is inclusive. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * End of time range. + * Range is inclusive. + * Must be in the future. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * Start of time range. + * Range is inclusive. + * @type \Google\Protobuf\Timestamp $end_time + * End of time range. + * Range is inclusive. + * Must be in the future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Control::initOnce(); + parent::__construct($data); + } + + /** + * Start of time range. + * Range is inclusive. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start of time range. + * Range is inclusive. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * End of time range. + * Range is inclusive. + * Must be in the future. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * End of time range. + * Range is inclusive. + * Must be in the future. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Control.php b/DiscoveryEngine/src/V1/Control.php new file mode 100644 index 000000000000..3e1f922dce18 --- /dev/null +++ b/DiscoveryEngine/src/V1/Control.php @@ -0,0 +1,443 @@ +google.cloud.discoveryengine.v1.Control + */ +class Control extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. Fully qualified name + * `projects/*/locations/global/dataStore/*/controls/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Required. Human readable name. The identifier used in UI views. + * Must be UTF-8 encoded string. Length limit is 128 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Output only. List of all [ServingConfig][] ids this control is attached to. + * May take up to 10 minutes to update after changes. + * + * Generated from protobuf field repeated string associated_serving_config_ids = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $associated_serving_config_ids; + /** + * Required. Immutable. What solution the control belongs to. + * Must be compatible with vertical of resource. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.SolutionType solution_type = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $solution_type = 0; + /** + * Specifies the use case for the control. + * Affects what condition fields can be set. + * Only applies to + * [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1.SolutionType.SOLUTION_TYPE_SEARCH]. + * Currently only allow one use case per control. + * Must be set when solution_type is + * [SolutionType.SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1.SolutionType.SOLUTION_TYPE_SEARCH]. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.SearchUseCase use_cases = 8; + */ + private $use_cases; + /** + * Determines when the associated action will trigger. + * Omit to always apply the action. + * Currently only a single condition may be specified. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Condition conditions = 5; + */ + private $conditions; + protected $action; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\Control\BoostAction $boost_action + * Defines a boost-type control + * @type \Google\Cloud\DiscoveryEngine\V1\Control\FilterAction $filter_action + * Defines a filter-type control + * Currently not supported by Recommendation + * @type \Google\Cloud\DiscoveryEngine\V1\Control\RedirectAction $redirect_action + * Defines a redirect-type control. + * @type \Google\Cloud\DiscoveryEngine\V1\Control\SynonymsAction $synonyms_action + * Treats a group of terms as synonyms of one another. + * @type string $name + * Immutable. Fully qualified name + * `projects/*/locations/global/dataStore/*/controls/*` + * @type string $display_name + * Required. Human readable name. The identifier used in UI views. + * Must be UTF-8 encoded string. Length limit is 128 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * @type array|\Google\Protobuf\Internal\RepeatedField $associated_serving_config_ids + * Output only. List of all [ServingConfig][] ids this control is attached to. + * May take up to 10 minutes to update after changes. + * @type int $solution_type + * Required. Immutable. What solution the control belongs to. + * Must be compatible with vertical of resource. + * Otherwise an INVALID ARGUMENT error is thrown. + * @type array|\Google\Protobuf\Internal\RepeatedField $use_cases + * Specifies the use case for the control. + * Affects what condition fields can be set. + * Only applies to + * [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1.SolutionType.SOLUTION_TYPE_SEARCH]. + * Currently only allow one use case per control. + * Must be set when solution_type is + * [SolutionType.SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1.SolutionType.SOLUTION_TYPE_SEARCH]. + * @type array<\Google\Cloud\DiscoveryEngine\V1\Condition>|\Google\Protobuf\Internal\RepeatedField $conditions + * Determines when the associated action will trigger. + * Omit to always apply the action. + * Currently only a single condition may be specified. + * Otherwise an INVALID ARGUMENT error is thrown. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Control::initOnce(); + parent::__construct($data); + } + + /** + * Defines a boost-type control + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control.BoostAction boost_action = 6; + * @return \Google\Cloud\DiscoveryEngine\V1\Control\BoostAction|null + */ + public function getBoostAction() + { + return $this->readOneof(6); + } + + public function hasBoostAction() + { + return $this->hasOneof(6); + } + + /** + * Defines a boost-type control + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control.BoostAction boost_action = 6; + * @param \Google\Cloud\DiscoveryEngine\V1\Control\BoostAction $var + * @return $this + */ + public function setBoostAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Control\BoostAction::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Defines a filter-type control + * Currently not supported by Recommendation + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control.FilterAction filter_action = 7; + * @return \Google\Cloud\DiscoveryEngine\V1\Control\FilterAction|null + */ + public function getFilterAction() + { + return $this->readOneof(7); + } + + public function hasFilterAction() + { + return $this->hasOneof(7); + } + + /** + * Defines a filter-type control + * Currently not supported by Recommendation + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control.FilterAction filter_action = 7; + * @param \Google\Cloud\DiscoveryEngine\V1\Control\FilterAction $var + * @return $this + */ + public function setFilterAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Control\FilterAction::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Defines a redirect-type control. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control.RedirectAction redirect_action = 9; + * @return \Google\Cloud\DiscoveryEngine\V1\Control\RedirectAction|null + */ + public function getRedirectAction() + { + return $this->readOneof(9); + } + + public function hasRedirectAction() + { + return $this->hasOneof(9); + } + + /** + * Defines a redirect-type control. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control.RedirectAction redirect_action = 9; + * @param \Google\Cloud\DiscoveryEngine\V1\Control\RedirectAction $var + * @return $this + */ + public function setRedirectAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Control\RedirectAction::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Treats a group of terms as synonyms of one another. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control.SynonymsAction synonyms_action = 10; + * @return \Google\Cloud\DiscoveryEngine\V1\Control\SynonymsAction|null + */ + public function getSynonymsAction() + { + return $this->readOneof(10); + } + + public function hasSynonymsAction() + { + return $this->hasOneof(10); + } + + /** + * Treats a group of terms as synonyms of one another. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control.SynonymsAction synonyms_action = 10; + * @param \Google\Cloud\DiscoveryEngine\V1\Control\SynonymsAction $var + * @return $this + */ + public function setSynonymsAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Control\SynonymsAction::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Immutable. Fully qualified name + * `projects/*/locations/global/dataStore/*/controls/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. Fully qualified name + * `projects/*/locations/global/dataStore/*/controls/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. Human readable name. The identifier used in UI views. + * Must be UTF-8 encoded string. Length limit is 128 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. Human readable name. The identifier used in UI views. + * Must be UTF-8 encoded string. Length limit is 128 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. List of all [ServingConfig][] ids this control is attached to. + * May take up to 10 minutes to update after changes. + * + * Generated from protobuf field repeated string associated_serving_config_ids = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAssociatedServingConfigIds() + { + return $this->associated_serving_config_ids; + } + + /** + * Output only. List of all [ServingConfig][] ids this control is attached to. + * May take up to 10 minutes to update after changes. + * + * Generated from protobuf field repeated string associated_serving_config_ids = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAssociatedServingConfigIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->associated_serving_config_ids = $arr; + + return $this; + } + + /** + * Required. Immutable. What solution the control belongs to. + * Must be compatible with vertical of resource. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.SolutionType solution_type = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @return int + */ + public function getSolutionType() + { + return $this->solution_type; + } + + /** + * Required. Immutable. What solution the control belongs to. + * Must be compatible with vertical of resource. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.SolutionType solution_type = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @param int $var + * @return $this + */ + public function setSolutionType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DiscoveryEngine\V1\SolutionType::class); + $this->solution_type = $var; + + return $this; + } + + /** + * Specifies the use case for the control. + * Affects what condition fields can be set. + * Only applies to + * [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1.SolutionType.SOLUTION_TYPE_SEARCH]. + * Currently only allow one use case per control. + * Must be set when solution_type is + * [SolutionType.SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1.SolutionType.SOLUTION_TYPE_SEARCH]. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.SearchUseCase use_cases = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUseCases() + { + return $this->use_cases; + } + + /** + * Specifies the use case for the control. + * Affects what condition fields can be set. + * Only applies to + * [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1.SolutionType.SOLUTION_TYPE_SEARCH]. + * Currently only allow one use case per control. + * Must be set when solution_type is + * [SolutionType.SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1.SolutionType.SOLUTION_TYPE_SEARCH]. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.SearchUseCase use_cases = 8; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUseCases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\DiscoveryEngine\V1\SearchUseCase::class); + $this->use_cases = $arr; + + return $this; + } + + /** + * Determines when the associated action will trigger. + * Omit to always apply the action. + * Currently only a single condition may be specified. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Condition conditions = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConditions() + { + return $this->conditions; + } + + /** + * Determines when the associated action will trigger. + * Omit to always apply the action. + * Currently only a single condition may be specified. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Condition conditions = 5; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Condition>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConditions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Condition::class); + $this->conditions = $arr; + + return $this; + } + + /** + * @return string + */ + public function getAction() + { + return $this->whichOneof("action"); + } + +} + diff --git a/DiscoveryEngine/src/V1/Control/BoostAction.php b/DiscoveryEngine/src/V1/Control/BoostAction.php new file mode 100644 index 000000000000..53fc5bd38390 --- /dev/null +++ b/DiscoveryEngine/src/V1/Control/BoostAction.php @@ -0,0 +1,168 @@ +google.cloud.discoveryengine.v1.Control.BoostAction + */ +class BoostAction extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Strength of the boost, which should be in [-1, 1]. Negative + * boost means demotion. Default is 0.0 (No-op). + * + * Generated from protobuf field float boost = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $boost = 0.0; + /** + * Required. Specifies which products to apply the boost to. + * If no filter is provided all products will be boosted (No-op). + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $filter = ''; + /** + * Required. Specifies which data store's documents can be boosted by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $data_store = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $boost + * Required. Strength of the boost, which should be in [-1, 1]. Negative + * boost means demotion. Default is 0.0 (No-op). + * @type string $filter + * Required. Specifies which products to apply the boost to. + * If no filter is provided all products will be boosted (No-op). + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * @type string $data_store + * Required. Specifies which data store's documents can be boosted by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Control::initOnce(); + parent::__construct($data); + } + + /** + * Required. Strength of the boost, which should be in [-1, 1]. Negative + * boost means demotion. Default is 0.0 (No-op). + * + * Generated from protobuf field float boost = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return float + */ + public function getBoost() + { + return $this->boost; + } + + /** + * Required. Strength of the boost, which should be in [-1, 1]. Negative + * boost means demotion. Default is 0.0 (No-op). + * + * Generated from protobuf field float boost = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param float $var + * @return $this + */ + public function setBoost($var) + { + GPBUtil::checkFloat($var); + $this->boost = $var; + + return $this; + } + + /** + * Required. Specifies which products to apply the boost to. + * If no filter is provided all products will be boosted (No-op). + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Required. Specifies which products to apply the boost to. + * If no filter is provided all products will be boosted (No-op). + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Required. Specifies which data store's documents can be boosted by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDataStore() + { + return $this->data_store; + } + + /** + * Required. Specifies which data store's documents can be boosted by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDataStore($var) + { + GPBUtil::checkString($var, True); + $this->data_store = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Control/FilterAction.php b/DiscoveryEngine/src/V1/Control/FilterAction.php new file mode 100644 index 000000000000..ec03e754cc07 --- /dev/null +++ b/DiscoveryEngine/src/V1/Control/FilterAction.php @@ -0,0 +1,131 @@ +google.cloud.discoveryengine.v1.Control.FilterAction + */ +class FilterAction extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A filter to apply on the matching condition results. + * Required + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. Otherwise an INVALID + * ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $filter = ''; + /** + * Required. Specifies which data store's documents can be filtered by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $data_store = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $filter + * Required. A filter to apply on the matching condition results. + * Required + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. Otherwise an INVALID + * ARGUMENT error is thrown. + * @type string $data_store + * Required. Specifies which data store's documents can be filtered by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Control::initOnce(); + parent::__construct($data); + } + + /** + * Required. A filter to apply on the matching condition results. + * Required + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. Otherwise an INVALID + * ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Required. A filter to apply on the matching condition results. + * Required + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. Otherwise an INVALID + * ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Required. Specifies which data store's documents can be filtered by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDataStore() + { + return $this->data_store; + } + + /** + * Required. Specifies which data store's documents can be filtered by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDataStore($var) + { + GPBUtil::checkString($var, True); + $this->data_store = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Control/RedirectAction.php b/DiscoveryEngine/src/V1/Control/RedirectAction.php new file mode 100644 index 000000000000..3b4116479b05 --- /dev/null +++ b/DiscoveryEngine/src/V1/Control/RedirectAction.php @@ -0,0 +1,80 @@ +google.cloud.discoveryengine.v1.Control.RedirectAction + */ +class RedirectAction extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The URI to which the shopper will be redirected. + * Required. + * URI must have length equal or less than 2000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string redirect_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $redirect_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $redirect_uri + * Required. The URI to which the shopper will be redirected. + * Required. + * URI must have length equal or less than 2000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Control::initOnce(); + parent::__construct($data); + } + + /** + * Required. The URI to which the shopper will be redirected. + * Required. + * URI must have length equal or less than 2000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string redirect_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getRedirectUri() + { + return $this->redirect_uri; + } + + /** + * Required. The URI to which the shopper will be redirected. + * Required. + * URI must have length equal or less than 2000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string redirect_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setRedirectUri($var) + { + GPBUtil::checkString($var, True); + $this->redirect_uri = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Control/SynonymsAction.php b/DiscoveryEngine/src/V1/Control/SynonymsAction.php new file mode 100644 index 000000000000..67c9674745da --- /dev/null +++ b/DiscoveryEngine/src/V1/Control/SynonymsAction.php @@ -0,0 +1,82 @@ +google.cloud.discoveryengine.v1.Control.SynonymsAction + */ +class SynonymsAction extends \Google\Protobuf\Internal\Message +{ + /** + * Defines a set of synonyms. + * Can specify up to 100 synonyms. + * Must specify at least 2 synonyms. Otherwise an INVALID ARGUMENT error is + * thrown. + * + * Generated from protobuf field repeated string synonyms = 1; + */ + private $synonyms; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $synonyms + * Defines a set of synonyms. + * Can specify up to 100 synonyms. + * Must specify at least 2 synonyms. Otherwise an INVALID ARGUMENT error is + * thrown. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Control::initOnce(); + parent::__construct($data); + } + + /** + * Defines a set of synonyms. + * Can specify up to 100 synonyms. + * Must specify at least 2 synonyms. Otherwise an INVALID ARGUMENT error is + * thrown. + * + * Generated from protobuf field repeated string synonyms = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSynonyms() + { + return $this->synonyms; + } + + /** + * Defines a set of synonyms. + * Can specify up to 100 synonyms. + * Must specify at least 2 synonyms. Otherwise an INVALID ARGUMENT error is + * thrown. + * + * Generated from protobuf field repeated string synonyms = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSynonyms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->synonyms = $arr; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Conversation.php b/DiscoveryEngine/src/V1/Conversation.php index 37f527d15623..2a217e603795 100644 --- a/DiscoveryEngine/src/V1/Conversation.php +++ b/DiscoveryEngine/src/V1/Conversation.php @@ -17,9 +17,9 @@ class Conversation extends \Google\Protobuf\Internal\Message { /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/dataStore/*/conversations/*` + * `projects/{project}/locations/global/collections/{collection}/dataStore/*/conversations/*` * or - * `project/*/locations/global/collections/{collection}/engines/*/conversations/*`. + * `projects/{project}/locations/global/collections/{collection}/engines/*/conversations/*`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ @@ -63,9 +63,9 @@ class Conversation extends \Google\Protobuf\Internal\Message * * @type string $name * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/dataStore/*/conversations/*` + * `projects/{project}/locations/global/collections/{collection}/dataStore/*/conversations/*` * or - * `project/*/locations/global/collections/{collection}/engines/*/conversations/*`. + * `projects/{project}/locations/global/collections/{collection}/engines/*/conversations/*`. * @type int $state * The state of the Conversation. * @type string $user_pseudo_id @@ -85,9 +85,9 @@ public function __construct($data = NULL) { /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/dataStore/*/conversations/*` + * `projects/{project}/locations/global/collections/{collection}/dataStore/*/conversations/*` * or - * `project/*/locations/global/collections/{collection}/engines/*/conversations/*`. + * `projects/{project}/locations/global/collections/{collection}/engines/*/conversations/*`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * @return string @@ -99,9 +99,9 @@ public function getName() /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/dataStore/*/conversations/*` + * `projects/{project}/locations/global/collections/{collection}/dataStore/*/conversations/*` * or - * `project/*/locations/global/collections/{collection}/engines/*/conversations/*`. + * `projects/{project}/locations/global/collections/{collection}/engines/*/conversations/*`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * @param string $var diff --git a/DiscoveryEngine/src/V1/CreateControlRequest.php b/DiscoveryEngine/src/V1/CreateControlRequest.php new file mode 100644 index 000000000000..98ecea4bb311 --- /dev/null +++ b/DiscoveryEngine/src/V1/CreateControlRequest.php @@ -0,0 +1,194 @@ +google.cloud.discoveryengine.v1.CreateControlRequest + */ +class CreateControlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The Control to create. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $control = null; + /** + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * This value must be within 1-63 characters. + * Valid characters are /[a-z][0-9]-_/. + * + * Generated from protobuf field string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $control_id = ''; + + /** + * @param string $parent Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. Please see + * {@see ControlServiceClient::dataStoreName()} for help formatting this field. + * @param \Google\Cloud\DiscoveryEngine\V1\Control $control Required. The Control to create. + * @param string $controlId Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * + * This value must be within 1-63 characters. + * Valid characters are /[a-z][0-9]-_/. + * + * @return \Google\Cloud\DiscoveryEngine\V1\CreateControlRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\DiscoveryEngine\V1\Control $control, string $controlId): self + { + return (new self()) + ->setParent($parent) + ->setControl($control) + ->setControlId($controlId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * @type \Google\Cloud\DiscoveryEngine\V1\Control $control + * Required. The Control to create. + * @type string $control_id + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * This value must be within 1-63 characters. + * Valid characters are /[a-z][0-9]-_/. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The Control to create. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\DiscoveryEngine\V1\Control|null + */ + public function getControl() + { + return $this->control; + } + + public function hasControl() + { + return isset($this->control); + } + + public function clearControl() + { + unset($this->control); + } + + /** + * Required. The Control to create. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\DiscoveryEngine\V1\Control $var + * @return $this + */ + public function setControl($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Control::class); + $this->control = $var; + + return $this; + } + + /** + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * This value must be within 1-63 characters. + * Valid characters are /[a-z][0-9]-_/. + * + * Generated from protobuf field string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getControlId() + { + return $this->control_id; + } + + /** + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * This value must be within 1-63 characters. + * Valid characters are /[a-z][0-9]-_/. + * + * Generated from protobuf field string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setControlId($var) + { + GPBUtil::checkString($var, True); + $this->control_id = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/CreateDocumentRequest.php b/DiscoveryEngine/src/V1/CreateDocumentRequest.php index 82088e790bb0..d189b13266d5 100644 --- a/DiscoveryEngine/src/V1/CreateDocumentRequest.php +++ b/DiscoveryEngine/src/V1/CreateDocumentRequest.php @@ -33,7 +33,7 @@ class CreateDocumentRequest extends \Google\Protobuf\Internal\Message protected $document = null; /** * Required. The ID to use for the - * [Document][google.cloud.discoveryengine.v1.Document], which will become the + * [Document][google.cloud.discoveryengine.v1.Document], which becomes the * final component of the * [Document.name][google.cloud.discoveryengine.v1.Document.name]. * If the caller does not have permission to create the @@ -58,7 +58,7 @@ class CreateDocumentRequest extends \Google\Protobuf\Internal\Message * @param \Google\Cloud\DiscoveryEngine\V1\Document $document Required. The [Document][google.cloud.discoveryengine.v1.Document] to * create. * @param string $documentId Required. The ID to use for the - * [Document][google.cloud.discoveryengine.v1.Document], which will become the + * [Document][google.cloud.discoveryengine.v1.Document], which becomes the * final component of the * [Document.name][google.cloud.discoveryengine.v1.Document.name]. * @@ -101,7 +101,7 @@ public static function build(string $parent, \Google\Cloud\DiscoveryEngine\V1\Do * create. * @type string $document_id * Required. The ID to use for the - * [Document][google.cloud.discoveryengine.v1.Document], which will become the + * [Document][google.cloud.discoveryengine.v1.Document], which becomes the * final component of the * [Document.name][google.cloud.discoveryengine.v1.Document.name]. * If the caller does not have permission to create the @@ -189,7 +189,7 @@ public function setDocument($var) /** * Required. The ID to use for the - * [Document][google.cloud.discoveryengine.v1.Document], which will become the + * [Document][google.cloud.discoveryengine.v1.Document], which becomes the * final component of the * [Document.name][google.cloud.discoveryengine.v1.Document.name]. * If the caller does not have permission to create the @@ -213,7 +213,7 @@ public function getDocumentId() /** * Required. The ID to use for the - * [Document][google.cloud.discoveryengine.v1.Document], which will become the + * [Document][google.cloud.discoveryengine.v1.Document], which becomes the * final component of the * [Document.name][google.cloud.discoveryengine.v1.Document.name]. * If the caller does not have permission to create the diff --git a/DiscoveryEngine/src/V1/CreateSchemaRequest.php b/DiscoveryEngine/src/V1/CreateSchemaRequest.php index 53ae57f984be..75b11e40f16a 100644 --- a/DiscoveryEngine/src/V1/CreateSchemaRequest.php +++ b/DiscoveryEngine/src/V1/CreateSchemaRequest.php @@ -32,8 +32,8 @@ class CreateSchemaRequest extends \Google\Protobuf\Internal\Message protected $schema = null; /** * Required. The ID to use for the - * [Schema][google.cloud.discoveryengine.v1.Schema], which will become the - * final component of the + * [Schema][google.cloud.discoveryengine.v1.Schema], which becomes the final + * component of the * [Schema.name][google.cloud.discoveryengine.v1.Schema.name]. * This field should conform to * [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length @@ -49,8 +49,8 @@ class CreateSchemaRequest extends \Google\Protobuf\Internal\Message * {@see SchemaServiceClient::dataStoreName()} for help formatting this field. * @param \Google\Cloud\DiscoveryEngine\V1\Schema $schema Required. The [Schema][google.cloud.discoveryengine.v1.Schema] to create. * @param string $schemaId Required. The ID to use for the - * [Schema][google.cloud.discoveryengine.v1.Schema], which will become the - * final component of the + * [Schema][google.cloud.discoveryengine.v1.Schema], which becomes the final + * component of the * [Schema.name][google.cloud.discoveryengine.v1.Schema.name]. * * This field should conform to @@ -82,8 +82,8 @@ public static function build(string $parent, \Google\Cloud\DiscoveryEngine\V1\Sc * Required. The [Schema][google.cloud.discoveryengine.v1.Schema] to create. * @type string $schema_id * Required. The ID to use for the - * [Schema][google.cloud.discoveryengine.v1.Schema], which will become the - * final component of the + * [Schema][google.cloud.discoveryengine.v1.Schema], which becomes the final + * component of the * [Schema.name][google.cloud.discoveryengine.v1.Schema.name]. * This field should conform to * [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length @@ -161,8 +161,8 @@ public function setSchema($var) /** * Required. The ID to use for the - * [Schema][google.cloud.discoveryengine.v1.Schema], which will become the - * final component of the + * [Schema][google.cloud.discoveryengine.v1.Schema], which becomes the final + * component of the * [Schema.name][google.cloud.discoveryengine.v1.Schema.name]. * This field should conform to * [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length @@ -178,8 +178,8 @@ public function getSchemaId() /** * Required. The ID to use for the - * [Schema][google.cloud.discoveryengine.v1.Schema], which will become the - * final component of the + * [Schema][google.cloud.discoveryengine.v1.Schema], which becomes the final + * component of the * [Schema.name][google.cloud.discoveryengine.v1.Schema.name]. * This field should conform to * [RFC-1034](https://tools.ietf.org/html/rfc1034) standard with a length diff --git a/DiscoveryEngine/src/V1/CreateSessionRequest.php b/DiscoveryEngine/src/V1/CreateSessionRequest.php new file mode 100644 index 000000000000..068ad30fa60c --- /dev/null +++ b/DiscoveryEngine/src/V1/CreateSessionRequest.php @@ -0,0 +1,132 @@ +google.cloud.discoveryengine.v1.CreateSessionRequest + */ +class CreateSessionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The session to create. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session session = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $session = null; + + /** + * @param string $parent Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}` + * Please see {@see ConversationalSearchServiceClient::dataStoreName()} for help formatting this field. + * @param \Google\Cloud\DiscoveryEngine\V1\Session $session Required. The session to create. + * + * @return \Google\Cloud\DiscoveryEngine\V1\CreateSessionRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\DiscoveryEngine\V1\Session $session): self + { + return (new self()) + ->setParent($parent) + ->setSession($session); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}` + * @type \Google\Cloud\DiscoveryEngine\V1\Session $session + * Required. The session to create. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The session to create. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session session = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\DiscoveryEngine\V1\Session|null + */ + public function getSession() + { + return $this->session; + } + + public function hasSession() + { + return isset($this->session); + } + + public function clearSession() + { + unset($this->session); + } + + /** + * Required. The session to create. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session session = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\DiscoveryEngine\V1\Session $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Session::class); + $this->session = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/DataStore.php b/DiscoveryEngine/src/V1/DataStore.php index 387f2238977b..73c19db07f00 100644 --- a/DiscoveryEngine/src/V1/DataStore.php +++ b/DiscoveryEngine/src/V1/DataStore.php @@ -72,6 +72,12 @@ class DataStore extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.protobuf.Timestamp create_time = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ protected $create_time = null; + /** + * Configuration for Document understanding and enrichment. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.DocumentProcessingConfig document_processing_config = 27; + */ + protected $document_processing_config = null; /** * The start schema to use for this * [DataStore][google.cloud.discoveryengine.v1.DataStore] when provisioning @@ -125,6 +131,8 @@ class DataStore extends \Google\Protobuf\Internal\Message * @type \Google\Protobuf\Timestamp $create_time * Output only. Timestamp the * [DataStore][google.cloud.discoveryengine.v1.DataStore] was created at. + * @type \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig $document_processing_config + * Configuration for Document understanding and enrichment. * @type \Google\Cloud\DiscoveryEngine\V1\Schema $starting_schema * The start schema to use for this * [DataStore][google.cloud.discoveryengine.v1.DataStore] when provisioning @@ -367,6 +375,42 @@ public function setCreateTime($var) return $this; } + /** + * Configuration for Document understanding and enrichment. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.DocumentProcessingConfig document_processing_config = 27; + * @return \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig|null + */ + public function getDocumentProcessingConfig() + { + return $this->document_processing_config; + } + + public function hasDocumentProcessingConfig() + { + return isset($this->document_processing_config); + } + + public function clearDocumentProcessingConfig() + { + unset($this->document_processing_config); + } + + /** + * Configuration for Document understanding and enrichment. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.DocumentProcessingConfig document_processing_config = 27; + * @param \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig $var + * @return $this + */ + public function setDocumentProcessingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig::class); + $this->document_processing_config = $var; + + return $this; + } + /** * The start schema to use for this * [DataStore][google.cloud.discoveryengine.v1.DataStore] when provisioning diff --git a/DiscoveryEngine/src/V1/DeleteControlRequest.php b/DiscoveryEngine/src/V1/DeleteControlRequest.php new file mode 100644 index 000000000000..e8a08f540dff --- /dev/null +++ b/DiscoveryEngine/src/V1/DeleteControlRequest.php @@ -0,0 +1,86 @@ +google.cloud.discoveryengine.v1.DeleteControlRequest + */ +class DeleteControlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * Please see {@see ControlServiceClient::controlName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1\DeleteControlRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/DeleteSessionRequest.php b/DiscoveryEngine/src/V1/DeleteSessionRequest.php new file mode 100644 index 000000000000..248bc92618cc --- /dev/null +++ b/DiscoveryEngine/src/V1/DeleteSessionRequest.php @@ -0,0 +1,86 @@ +google.cloud.discoveryengine.v1.DeleteSessionRequest + */ +class DeleteSessionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Session to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the Session to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}` + * Please see {@see ConversationalSearchServiceClient::sessionName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1\DeleteSessionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Session to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Session to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Session to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/DocumentInfo.php b/DiscoveryEngine/src/V1/DocumentInfo.php index e9156ee0276b..2484b108f2a4 100644 --- a/DiscoveryEngine/src/V1/DocumentInfo.php +++ b/DiscoveryEngine/src/V1/DocumentInfo.php @@ -17,7 +17,7 @@ class DocumentInfo extends \Google\Protobuf\Internal\Message { /** * Quantity of the Document associated with the user event. Defaults to 1. - * For example, this field will be 2 if two quantities of the same Document + * For example, this field is 2 if two quantities of the same Document * are involved in a `add-to-cart` event. * Required for events of the following event types: * * `add-to-cart` @@ -52,7 +52,7 @@ class DocumentInfo extends \Google\Protobuf\Internal\Message * allowed for website data stores. * @type int $quantity * Quantity of the Document associated with the user event. Defaults to 1. - * For example, this field will be 2 if two quantities of the same Document + * For example, this field is 2 if two quantities of the same Document * are involved in a `add-to-cart` event. * Required for events of the following event types: * * `add-to-cart` @@ -168,7 +168,7 @@ public function setUri($var) /** * Quantity of the Document associated with the user event. Defaults to 1. - * For example, this field will be 2 if two quantities of the same Document + * For example, this field is 2 if two quantities of the same Document * are involved in a `add-to-cart` event. * Required for events of the following event types: * * `add-to-cart` @@ -194,7 +194,7 @@ public function clearQuantity() /** * Quantity of the Document associated with the user event. Defaults to 1. - * For example, this field will be 2 if two quantities of the same Document + * For example, this field is 2 if two quantities of the same Document * are involved in a `add-to-cart` event. * Required for events of the following event types: * * `add-to-cart` diff --git a/DiscoveryEngine/src/V1/DocumentProcessingConfig.php b/DiscoveryEngine/src/V1/DocumentProcessingConfig.php new file mode 100644 index 000000000000..864bb4b5c7c6 --- /dev/null +++ b/DiscoveryEngine/src/V1/DocumentProcessingConfig.php @@ -0,0 +1,198 @@ +google.cloud.discoveryengine.v1.DocumentProcessingConfig + */ +class DocumentProcessingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * The full resource name of the Document Processing Config. + * Format: + * `projects/*/locations/*/collections/*/dataStores/*/documentProcessingConfig`. + * + * Generated from protobuf field string name = 1; + */ + protected $name = ''; + /** + * Configurations for default Document parser. + * If not specified, we will configure it as default DigitalParsingConfig, and + * the default parsing config will be applied to all file types for Document + * parsing. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig default_parsing_config = 4; + */ + protected $default_parsing_config = null; + /** + * Map from file type to override the default parsing configuration based on + * the file type. Supported keys: + * * `pdf`: Override parsing config for PDF files, either digital parsing, ocr + * parsing or layout parsing is supported. + * * `html`: Override parsing config for HTML files, only digital parsing and + * or layout parsing are supported. + * * `docx`: Override parsing config for DOCX files, only digital parsing and + * or layout parsing are supported. + * + * Generated from protobuf field map parsing_config_overrides = 5; + */ + private $parsing_config_overrides; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * The full resource name of the Document Processing Config. + * Format: + * `projects/*/locations/*/collections/*/dataStores/*/documentProcessingConfig`. + * @type \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig $default_parsing_config + * Configurations for default Document parser. + * If not specified, we will configure it as default DigitalParsingConfig, and + * the default parsing config will be applied to all file types for Document + * parsing. + * @type array|\Google\Protobuf\Internal\MapField $parsing_config_overrides + * Map from file type to override the default parsing configuration based on + * the file type. Supported keys: + * * `pdf`: Override parsing config for PDF files, either digital parsing, ocr + * parsing or layout parsing is supported. + * * `html`: Override parsing config for HTML files, only digital parsing and + * or layout parsing are supported. + * * `docx`: Override parsing config for DOCX files, only digital parsing and + * or layout parsing are supported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\DocumentProcessingConfig::initOnce(); + parent::__construct($data); + } + + /** + * The full resource name of the Document Processing Config. + * Format: + * `projects/*/locations/*/collections/*/dataStores/*/documentProcessingConfig`. + * + * Generated from protobuf field string name = 1; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * The full resource name of the Document Processing Config. + * Format: + * `projects/*/locations/*/collections/*/dataStores/*/documentProcessingConfig`. + * + * Generated from protobuf field string name = 1; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Configurations for default Document parser. + * If not specified, we will configure it as default DigitalParsingConfig, and + * the default parsing config will be applied to all file types for Document + * parsing. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig default_parsing_config = 4; + * @return \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig|null + */ + public function getDefaultParsingConfig() + { + return $this->default_parsing_config; + } + + public function hasDefaultParsingConfig() + { + return isset($this->default_parsing_config); + } + + public function clearDefaultParsingConfig() + { + unset($this->default_parsing_config); + } + + /** + * Configurations for default Document parser. + * If not specified, we will configure it as default DigitalParsingConfig, and + * the default parsing config will be applied to all file types for Document + * parsing. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig default_parsing_config = 4; + * @param \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig $var + * @return $this + */ + public function setDefaultParsingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig::class); + $this->default_parsing_config = $var; + + return $this; + } + + /** + * Map from file type to override the default parsing configuration based on + * the file type. Supported keys: + * * `pdf`: Override parsing config for PDF files, either digital parsing, ocr + * parsing or layout parsing is supported. + * * `html`: Override parsing config for HTML files, only digital parsing and + * or layout parsing are supported. + * * `docx`: Override parsing config for DOCX files, only digital parsing and + * or layout parsing are supported. + * + * Generated from protobuf field map parsing_config_overrides = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getParsingConfigOverrides() + { + return $this->parsing_config_overrides; + } + + /** + * Map from file type to override the default parsing configuration based on + * the file type. Supported keys: + * * `pdf`: Override parsing config for PDF files, either digital parsing, ocr + * parsing or layout parsing is supported. + * * `html`: Override parsing config for HTML files, only digital parsing and + * or layout parsing are supported. + * * `docx`: Override parsing config for DOCX files, only digital parsing and + * or layout parsing are supported. + * + * Generated from protobuf field map parsing_config_overrides = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setParsingConfigOverrides($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig::class); + $this->parsing_config_overrides = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/DocumentProcessingConfig/ParsingConfig.php b/DiscoveryEngine/src/V1/DocumentProcessingConfig/ParsingConfig.php new file mode 100644 index 000000000000..eb2cc5e967ce --- /dev/null +++ b/DiscoveryEngine/src/V1/DocumentProcessingConfig/ParsingConfig.php @@ -0,0 +1,112 @@ +google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig + */ +class ParsingConfig extends \Google\Protobuf\Internal\Message +{ + protected $type_dedicated_config; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig\DigitalParsingConfig $digital_parsing_config + * Configurations applied to digital parser. + * @type \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig\OcrParsingConfig $ocr_parsing_config + * Configurations applied to OCR parser. Currently it only applies to + * PDFs. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\DocumentProcessingConfig::initOnce(); + parent::__construct($data); + } + + /** + * Configurations applied to digital parser. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig.DigitalParsingConfig digital_parsing_config = 1; + * @return \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig\DigitalParsingConfig|null + */ + public function getDigitalParsingConfig() + { + return $this->readOneof(1); + } + + public function hasDigitalParsingConfig() + { + return $this->hasOneof(1); + } + + /** + * Configurations applied to digital parser. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig.DigitalParsingConfig digital_parsing_config = 1; + * @param \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig\DigitalParsingConfig $var + * @return $this + */ + public function setDigitalParsingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig\DigitalParsingConfig::class); + $this->writeOneof(1, $var); + + return $this; + } + + /** + * Configurations applied to OCR parser. Currently it only applies to + * PDFs. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig.OcrParsingConfig ocr_parsing_config = 2; + * @return \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig\OcrParsingConfig|null + */ + public function getOcrParsingConfig() + { + return $this->readOneof(2); + } + + public function hasOcrParsingConfig() + { + return $this->hasOneof(2); + } + + /** + * Configurations applied to OCR parser. Currently it only applies to + * PDFs. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig.OcrParsingConfig ocr_parsing_config = 2; + * @param \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig\OcrParsingConfig $var + * @return $this + */ + public function setOcrParsingConfig($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\DocumentProcessingConfig\ParsingConfig\OcrParsingConfig::class); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * @return string + */ + public function getTypeDedicatedConfig() + { + return $this->whichOneof("type_dedicated_config"); + } + +} + + diff --git a/DiscoveryEngine/src/V1/DocumentProcessingConfig/ParsingConfig/DigitalParsingConfig.php b/DiscoveryEngine/src/V1/DocumentProcessingConfig/ParsingConfig/DigitalParsingConfig.php new file mode 100644 index 000000000000..2678652787cc --- /dev/null +++ b/DiscoveryEngine/src/V1/DocumentProcessingConfig/ParsingConfig/DigitalParsingConfig.php @@ -0,0 +1,34 @@ +google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig.DigitalParsingConfig + */ +class DigitalParsingConfig extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\DocumentProcessingConfig::initOnce(); + parent::__construct($data); + } + +} + + diff --git a/DiscoveryEngine/src/V1/DocumentProcessingConfig/ParsingConfig/OcrParsingConfig.php b/DiscoveryEngine/src/V1/DocumentProcessingConfig/ParsingConfig/OcrParsingConfig.php new file mode 100644 index 000000000000..c83c15b830c3 --- /dev/null +++ b/DiscoveryEngine/src/V1/DocumentProcessingConfig/ParsingConfig/OcrParsingConfig.php @@ -0,0 +1,115 @@ +google.cloud.discoveryengine.v1.DocumentProcessingConfig.ParsingConfig.OcrParsingConfig + */ +class OcrParsingConfig extends \Google\Protobuf\Internal\Message +{ + /** + * [DEPRECATED] This field is deprecated. To use the additional enhanced + * document elements processing, please switch to `layout_parsing_config`. + * + * Generated from protobuf field repeated string enhanced_document_elements = 1 [deprecated = true]; + * @deprecated + */ + private $enhanced_document_elements; + /** + * If true, will use native text instead of OCR text on pages containing + * native text. + * + * Generated from protobuf field bool use_native_text = 2; + */ + protected $use_native_text = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $enhanced_document_elements + * [DEPRECATED] This field is deprecated. To use the additional enhanced + * document elements processing, please switch to `layout_parsing_config`. + * @type bool $use_native_text + * If true, will use native text instead of OCR text on pages containing + * native text. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\DocumentProcessingConfig::initOnce(); + parent::__construct($data); + } + + /** + * [DEPRECATED] This field is deprecated. To use the additional enhanced + * document elements processing, please switch to `layout_parsing_config`. + * + * Generated from protobuf field repeated string enhanced_document_elements = 1 [deprecated = true]; + * @return \Google\Protobuf\Internal\RepeatedField + * @deprecated + */ + public function getEnhancedDocumentElements() + { + @trigger_error('enhanced_document_elements is deprecated.', E_USER_DEPRECATED); + return $this->enhanced_document_elements; + } + + /** + * [DEPRECATED] This field is deprecated. To use the additional enhanced + * document elements processing, please switch to `layout_parsing_config`. + * + * Generated from protobuf field repeated string enhanced_document_elements = 1 [deprecated = true]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + * @deprecated + */ + public function setEnhancedDocumentElements($var) + { + @trigger_error('enhanced_document_elements is deprecated.', E_USER_DEPRECATED); + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->enhanced_document_elements = $arr; + + return $this; + } + + /** + * If true, will use native text instead of OCR text on pages containing + * native text. + * + * Generated from protobuf field bool use_native_text = 2; + * @return bool + */ + public function getUseNativeText() + { + return $this->use_native_text; + } + + /** + * If true, will use native text instead of OCR text on pages containing + * native text. + * + * Generated from protobuf field bool use_native_text = 2; + * @param bool $var + * @return $this + */ + public function setUseNativeText($var) + { + GPBUtil::checkBool($var); + $this->use_native_text = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Engine.php b/DiscoveryEngine/src/V1/Engine.php index 7e19a11401d5..b5d7db997a93 100644 --- a/DiscoveryEngine/src/V1/Engine.php +++ b/DiscoveryEngine/src/V1/Engine.php @@ -78,7 +78,7 @@ class Engine extends \Google\Protobuf\Internal\Message * The restriction of the Engine industry vertical is based on * [DataStore][google.cloud.discoveryengine.v1.DataStore]: If unspecified, * default to `GENERIC`. Vertical on Engine has to match vertical of the - * DataStore liniked to the engine. + * DataStore linked to the engine. * * Generated from protobuf field .google.cloud.discoveryengine.v1.IndustryVertical industry_vertical = 16; */ @@ -149,7 +149,7 @@ class Engine extends \Google\Protobuf\Internal\Message * The restriction of the Engine industry vertical is based on * [DataStore][google.cloud.discoveryengine.v1.DataStore]: If unspecified, * default to `GENERIC`. Vertical on Engine has to match vertical of the - * DataStore liniked to the engine. + * DataStore linked to the engine. * @type \Google\Cloud\DiscoveryEngine\V1\Engine\CommonConfig $common_config * Common config spec that specifies the metadata of the engine. * } @@ -489,7 +489,7 @@ public function setSolutionType($var) * The restriction of the Engine industry vertical is based on * [DataStore][google.cloud.discoveryengine.v1.DataStore]: If unspecified, * default to `GENERIC`. Vertical on Engine has to match vertical of the - * DataStore liniked to the engine. + * DataStore linked to the engine. * * Generated from protobuf field .google.cloud.discoveryengine.v1.IndustryVertical industry_vertical = 16; * @return int @@ -504,7 +504,7 @@ public function getIndustryVertical() * The restriction of the Engine industry vertical is based on * [DataStore][google.cloud.discoveryengine.v1.DataStore]: If unspecified, * default to `GENERIC`. Vertical on Engine has to match vertical of the - * DataStore liniked to the engine. + * DataStore linked to the engine. * * Generated from protobuf field .google.cloud.discoveryengine.v1.IndustryVertical industry_vertical = 16; * @param int $var diff --git a/DiscoveryEngine/src/V1/Engine/CommonConfig.php b/DiscoveryEngine/src/V1/Engine/CommonConfig.php index 4de53c05935b..eeb5c06a5d35 100644 --- a/DiscoveryEngine/src/V1/Engine/CommonConfig.php +++ b/DiscoveryEngine/src/V1/Engine/CommonConfig.php @@ -16,10 +16,10 @@ class CommonConfig extends \Google\Protobuf\Internal\Message { /** - * Immutable. The name of the company, business or entity that is associated - * with the engine. Setting this may help improve LLM related features. + * The name of the company, business or entity that is associated with the + * engine. Setting this may help improve LLM related features. * - * Generated from protobuf field string company_name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * Generated from protobuf field string company_name = 1; */ protected $company_name = ''; @@ -30,8 +30,8 @@ class CommonConfig extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $company_name - * Immutable. The name of the company, business or entity that is associated - * with the engine. Setting this may help improve LLM related features. + * The name of the company, business or entity that is associated with the + * engine. Setting this may help improve LLM related features. * } */ public function __construct($data = NULL) { @@ -40,10 +40,10 @@ public function __construct($data = NULL) { } /** - * Immutable. The name of the company, business or entity that is associated - * with the engine. Setting this may help improve LLM related features. + * The name of the company, business or entity that is associated with the + * engine. Setting this may help improve LLM related features. * - * Generated from protobuf field string company_name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * Generated from protobuf field string company_name = 1; * @return string */ public function getCompanyName() @@ -52,10 +52,10 @@ public function getCompanyName() } /** - * Immutable. The name of the company, business or entity that is associated - * with the engine. Setting this may help improve LLM related features. + * The name of the company, business or entity that is associated with the + * engine. Setting this may help improve LLM related features. * - * Generated from protobuf field string company_name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * Generated from protobuf field string company_name = 1; * @param string $var * @return $this */ diff --git a/DiscoveryEngine/src/V1/FactChunk.php b/DiscoveryEngine/src/V1/FactChunk.php new file mode 100644 index 000000000000..5707d7e2e864 --- /dev/null +++ b/DiscoveryEngine/src/V1/FactChunk.php @@ -0,0 +1,181 @@ +google.cloud.discoveryengine.v1.FactChunk + */ +class FactChunk extends \Google\Protobuf\Internal\Message +{ + /** + * Text content of the fact chunk. Can be at most 10K characters long. + * + * Generated from protobuf field string chunk_text = 1; + */ + protected $chunk_text = ''; + /** + * Source from which this fact chunk was retrieved. If it was retrieved + * from the GroundingFacts provided in the request then this field will + * contain the index of the specific fact from which this chunk was + * retrieved. + * + * Generated from protobuf field string source = 2; + */ + protected $source = ''; + /** + * The index of this chunk. Currently, only used for the streaming mode. + * + * Generated from protobuf field int32 index = 4; + */ + protected $index = 0; + /** + * More fine-grained information for the source reference. + * + * Generated from protobuf field map source_metadata = 3; + */ + private $source_metadata; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $chunk_text + * Text content of the fact chunk. Can be at most 10K characters long. + * @type string $source + * Source from which this fact chunk was retrieved. If it was retrieved + * from the GroundingFacts provided in the request then this field will + * contain the index of the specific fact from which this chunk was + * retrieved. + * @type int $index + * The index of this chunk. Currently, only used for the streaming mode. + * @type array|\Google\Protobuf\Internal\MapField $source_metadata + * More fine-grained information for the source reference. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Grounding::initOnce(); + parent::__construct($data); + } + + /** + * Text content of the fact chunk. Can be at most 10K characters long. + * + * Generated from protobuf field string chunk_text = 1; + * @return string + */ + public function getChunkText() + { + return $this->chunk_text; + } + + /** + * Text content of the fact chunk. Can be at most 10K characters long. + * + * Generated from protobuf field string chunk_text = 1; + * @param string $var + * @return $this + */ + public function setChunkText($var) + { + GPBUtil::checkString($var, True); + $this->chunk_text = $var; + + return $this; + } + + /** + * Source from which this fact chunk was retrieved. If it was retrieved + * from the GroundingFacts provided in the request then this field will + * contain the index of the specific fact from which this chunk was + * retrieved. + * + * Generated from protobuf field string source = 2; + * @return string + */ + public function getSource() + { + return $this->source; + } + + /** + * Source from which this fact chunk was retrieved. If it was retrieved + * from the GroundingFacts provided in the request then this field will + * contain the index of the specific fact from which this chunk was + * retrieved. + * + * Generated from protobuf field string source = 2; + * @param string $var + * @return $this + */ + public function setSource($var) + { + GPBUtil::checkString($var, True); + $this->source = $var; + + return $this; + } + + /** + * The index of this chunk. Currently, only used for the streaming mode. + * + * Generated from protobuf field int32 index = 4; + * @return int + */ + public function getIndex() + { + return $this->index; + } + + /** + * The index of this chunk. Currently, only used for the streaming mode. + * + * Generated from protobuf field int32 index = 4; + * @param int $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkInt32($var); + $this->index = $var; + + return $this; + } + + /** + * More fine-grained information for the source reference. + * + * Generated from protobuf field map source_metadata = 3; + * @return \Google\Protobuf\Internal\MapField + */ + public function getSourceMetadata() + { + return $this->source_metadata; + } + + /** + * More fine-grained information for the source reference. + * + * Generated from protobuf field map source_metadata = 3; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setSourceMetadata($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->source_metadata = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/FirestoreSource.php b/DiscoveryEngine/src/V1/FirestoreSource.php index 361f4b02a1f7..19aec3390a81 100644 --- a/DiscoveryEngine/src/V1/FirestoreSource.php +++ b/DiscoveryEngine/src/V1/FirestoreSource.php @@ -31,8 +31,8 @@ class FirestoreSource extends \Google\Protobuf\Internal\Message */ protected $database_id = ''; /** - * Required. The Firestore collection to copy the data from with a length - * limit of 1,500 characters. + * Required. The Firestore collection (or entity) to copy the data from with a + * length limit of 1,500 characters. * * Generated from protobuf field string collection_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ @@ -62,8 +62,8 @@ class FirestoreSource extends \Google\Protobuf\Internal\Message * Required. The Firestore database to copy the data from with a length limit * of 256 characters. * @type string $collection_id - * Required. The Firestore collection to copy the data from with a length - * limit of 1,500 characters. + * Required. The Firestore collection (or entity) to copy the data from with a + * length limit of 1,500 characters. * @type string $gcs_staging_dir * Intermediate Cloud Storage directory used for the import with a length * limit of 2,000 characters. Can be specified if one wants to have the @@ -136,8 +136,8 @@ public function setDatabaseId($var) } /** - * Required. The Firestore collection to copy the data from with a length - * limit of 1,500 characters. + * Required. The Firestore collection (or entity) to copy the data from with a + * length limit of 1,500 characters. * * Generated from protobuf field string collection_id = 3 [(.google.api.field_behavior) = REQUIRED]; * @return string @@ -148,8 +148,8 @@ public function getCollectionId() } /** - * Required. The Firestore collection to copy the data from with a length - * limit of 1,500 characters. + * Required. The Firestore collection (or entity) to copy the data from with a + * length limit of 1,500 characters. * * Generated from protobuf field string collection_id = 3 [(.google.api.field_behavior) = REQUIRED]; * @param string $var diff --git a/DiscoveryEngine/src/V1/GcsSource.php b/DiscoveryEngine/src/V1/GcsSource.php index 29b8a73ad4f4..38121444def8 100644 --- a/DiscoveryEngine/src/V1/GcsSource.php +++ b/DiscoveryEngine/src/V1/GcsSource.php @@ -16,7 +16,7 @@ class GcsSource extends \Google\Protobuf\Internal\Message { /** - * Required. Cloud Storage URIs to input files. URI can be up to + * Required. Cloud Storage URIs to input files. Each URI can be up to * 2000 characters long. URIs can match the full object path (for example, * `gs://bucket/directory/object.json`) or a pattern matching one or more * files, such as `gs://bucket/directory/*.json`. @@ -44,7 +44,7 @@ class GcsSource extends \Google\Protobuf\Internal\Message * [Schema][google.cloud.discoveryengine.v1.Schema] of the * data store. Each entry after the header is imported as a Document. * This can only be used by the GENERIC Data Store vertical. - * Supported values for user even imports: + * Supported values for user event imports: * * `user_event` (default): One JSON * [UserEvent][google.cloud.discoveryengine.v1.UserEvent] per line. * @@ -59,7 +59,7 @@ class GcsSource extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type array|\Google\Protobuf\Internal\RepeatedField $input_uris - * Required. Cloud Storage URIs to input files. URI can be up to + * Required. Cloud Storage URIs to input files. Each URI can be up to * 2000 characters long. URIs can match the full object path (for example, * `gs://bucket/directory/object.json`) or a pattern matching one or more * files, such as `gs://bucket/directory/*.json`. @@ -83,7 +83,7 @@ class GcsSource extends \Google\Protobuf\Internal\Message * [Schema][google.cloud.discoveryengine.v1.Schema] of the * data store. Each entry after the header is imported as a Document. * This can only be used by the GENERIC Data Store vertical. - * Supported values for user even imports: + * Supported values for user event imports: * * `user_event` (default): One JSON * [UserEvent][google.cloud.discoveryengine.v1.UserEvent] per line. * } @@ -94,7 +94,7 @@ public function __construct($data = NULL) { } /** - * Required. Cloud Storage URIs to input files. URI can be up to + * Required. Cloud Storage URIs to input files. Each URI can be up to * 2000 characters long. URIs can match the full object path (for example, * `gs://bucket/directory/object.json`) or a pattern matching one or more * files, such as `gs://bucket/directory/*.json`. @@ -111,7 +111,7 @@ public function getInputUris() } /** - * Required. Cloud Storage URIs to input files. URI can be up to + * Required. Cloud Storage URIs to input files. Each URI can be up to * 2000 characters long. URIs can match the full object path (for example, * `gs://bucket/directory/object.json`) or a pattern matching one or more * files, such as `gs://bucket/directory/*.json`. @@ -148,7 +148,7 @@ public function setInputUris($var) * [Schema][google.cloud.discoveryengine.v1.Schema] of the * data store. Each entry after the header is imported as a Document. * This can only be used by the GENERIC Data Store vertical. - * Supported values for user even imports: + * Supported values for user event imports: * * `user_event` (default): One JSON * [UserEvent][google.cloud.discoveryengine.v1.UserEvent] per line. * @@ -177,7 +177,7 @@ public function getDataSchema() * [Schema][google.cloud.discoveryengine.v1.Schema] of the * data store. Each entry after the header is imported as a Document. * This can only be used by the GENERIC Data Store vertical. - * Supported values for user even imports: + * Supported values for user event imports: * * `user_event` (default): One JSON * [UserEvent][google.cloud.discoveryengine.v1.UserEvent] per line. * diff --git a/DiscoveryEngine/src/V1/GetAnswerRequest.php b/DiscoveryEngine/src/V1/GetAnswerRequest.php new file mode 100644 index 000000000000..15f35eb2bc75 --- /dev/null +++ b/DiscoveryEngine/src/V1/GetAnswerRequest.php @@ -0,0 +1,86 @@ +google.cloud.discoveryengine.v1.GetAnswerRequest + */ +class GetAnswerRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Answer to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/engines/{engine_id}/sessions/{session_id}/answers/{answer_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the Answer to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/engines/{engine_id}/sessions/{session_id}/answers/{answer_id}` + * Please see {@see ConversationalSearchServiceClient::answerName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1\GetAnswerRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Answer to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/engines/{engine_id}/sessions/{session_id}/answers/{answer_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Answer to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/engines/{engine_id}/sessions/{session_id}/answers/{answer_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Answer to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/engines/{engine_id}/sessions/{session_id}/answers/{answer_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/GetControlRequest.php b/DiscoveryEngine/src/V1/GetControlRequest.php new file mode 100644 index 000000000000..083e30a65dfc --- /dev/null +++ b/DiscoveryEngine/src/V1/GetControlRequest.php @@ -0,0 +1,86 @@ +google.cloud.discoveryengine.v1.GetControlRequest + */ +class GetControlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * Please see {@see ControlServiceClient::controlName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1\GetControlRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/GetSessionRequest.php b/DiscoveryEngine/src/V1/GetSessionRequest.php new file mode 100644 index 000000000000..dd3fa5c5da5f --- /dev/null +++ b/DiscoveryEngine/src/V1/GetSessionRequest.php @@ -0,0 +1,86 @@ +google.cloud.discoveryengine.v1.GetSessionRequest + */ +class GetSessionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Session to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the Session to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}` + * Please see {@see ConversationalSearchServiceClient::sessionName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1\GetSessionRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Session to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Session to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Session to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}/sessions/{session_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/GroundingFact.php b/DiscoveryEngine/src/V1/GroundingFact.php new file mode 100644 index 000000000000..b640640efa03 --- /dev/null +++ b/DiscoveryEngine/src/V1/GroundingFact.php @@ -0,0 +1,109 @@ +google.cloud.discoveryengine.v1.GroundingFact + */ +class GroundingFact extends \Google\Protobuf\Internal\Message +{ + /** + * Text content of the fact. Can be at most 10K characters long. + * + * Generated from protobuf field string fact_text = 1; + */ + protected $fact_text = ''; + /** + * Attributes associated with the fact. + * Common attributes include `source` (indicating where the fact was sourced + * from), `author` (indicating the author of the fact), and so on. + * + * Generated from protobuf field map attributes = 2; + */ + private $attributes; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $fact_text + * Text content of the fact. Can be at most 10K characters long. + * @type array|\Google\Protobuf\Internal\MapField $attributes + * Attributes associated with the fact. + * Common attributes include `source` (indicating where the fact was sourced + * from), `author` (indicating the author of the fact), and so on. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Grounding::initOnce(); + parent::__construct($data); + } + + /** + * Text content of the fact. Can be at most 10K characters long. + * + * Generated from protobuf field string fact_text = 1; + * @return string + */ + public function getFactText() + { + return $this->fact_text; + } + + /** + * Text content of the fact. Can be at most 10K characters long. + * + * Generated from protobuf field string fact_text = 1; + * @param string $var + * @return $this + */ + public function setFactText($var) + { + GPBUtil::checkString($var, True); + $this->fact_text = $var; + + return $this; + } + + /** + * Attributes associated with the fact. + * Common attributes include `source` (indicating where the fact was sourced + * from), `author` (indicating the author of the fact), and so on. + * + * Generated from protobuf field map attributes = 2; + * @return \Google\Protobuf\Internal\MapField + */ + public function getAttributes() + { + return $this->attributes; + } + + /** + * Attributes associated with the fact. + * Common attributes include `source` (indicating where the fact was sourced + * from), `author` (indicating the author of the fact), and so on. + * + * Generated from protobuf field map attributes = 2; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setAttributes($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->attributes = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/ListControlsRequest.php b/DiscoveryEngine/src/V1/ListControlsRequest.php new file mode 100644 index 000000000000..c980c9323f2d --- /dev/null +++ b/DiscoveryEngine/src/V1/ListControlsRequest.php @@ -0,0 +1,218 @@ +google.cloud.discoveryengine.v1.ListControlsRequest + */ +class ListControlsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * [filter][google.cloud.discoveryengine.v1.ListControlsRequest.filter] is + * unset. Currently this field is unsupported. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. Please see + * {@see ControlServiceClient::dataStoreName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1\ListControlsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * @type int $page_size + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @type string $page_token + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * @type string $filter + * Optional. A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * [filter][google.cloud.discoveryengine.v1.ListControlsRequest.filter] is + * unset. Currently this field is unsupported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * [filter][google.cloud.discoveryengine.v1.ListControlsRequest.filter] is + * unset. Currently this field is unsupported. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * [filter][google.cloud.discoveryengine.v1.ListControlsRequest.filter] is + * unset. Currently this field is unsupported. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/ListControlsResponse.php b/DiscoveryEngine/src/V1/ListControlsResponse.php new file mode 100644 index 000000000000..f0bbd9ba3e7e --- /dev/null +++ b/DiscoveryEngine/src/V1/ListControlsResponse.php @@ -0,0 +1,101 @@ +google.cloud.discoveryengine.v1.ListControlsResponse + */ +class ListControlsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * All the Controls for a given data store. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Control controls = 1; + */ + private $controls; + /** + * Pagination token, if not returned indicates the last page. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DiscoveryEngine\V1\Control>|\Google\Protobuf\Internal\RepeatedField $controls + * All the Controls for a given data store. + * @type string $next_page_token + * Pagination token, if not returned indicates the last page. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * All the Controls for a given data store. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Control controls = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getControls() + { + return $this->controls; + } + + /** + * All the Controls for a given data store. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Control controls = 1; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Control>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setControls($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Control::class); + $this->controls = $arr; + + return $this; + } + + /** + * Pagination token, if not returned indicates the last page. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Pagination token, if not returned indicates the last page. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/ListDataStoresRequest.php b/DiscoveryEngine/src/V1/ListDataStoresRequest.php index 27449b1351a6..dc3e12ae5200 100644 --- a/DiscoveryEngine/src/V1/ListDataStoresRequest.php +++ b/DiscoveryEngine/src/V1/ListDataStoresRequest.php @@ -52,8 +52,8 @@ class ListDataStoresRequest extends \Google\Protobuf\Internal\Message */ protected $page_token = ''; /** - * Filter by solution type. For example: filter = - * 'solution_type:SOLUTION_TYPE_SEARCH' + * Filter by solution type . + * For example: `filter = 'solution_type:SOLUTION_TYPE_SEARCH'` * * Generated from protobuf field string filter = 4; */ @@ -108,8 +108,8 @@ public static function build(string $parent): self * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. * @type string $filter - * Filter by solution type. For example: filter = - * 'solution_type:SOLUTION_TYPE_SEARCH' + * Filter by solution type . + * For example: `filter = 'solution_type:SOLUTION_TYPE_SEARCH'` * } */ public function __construct($data = NULL) { @@ -228,8 +228,8 @@ public function setPageToken($var) } /** - * Filter by solution type. For example: filter = - * 'solution_type:SOLUTION_TYPE_SEARCH' + * Filter by solution type . + * For example: `filter = 'solution_type:SOLUTION_TYPE_SEARCH'` * * Generated from protobuf field string filter = 4; * @return string @@ -240,8 +240,8 @@ public function getFilter() } /** - * Filter by solution type. For example: filter = - * 'solution_type:SOLUTION_TYPE_SEARCH' + * Filter by solution type . + * For example: `filter = 'solution_type:SOLUTION_TYPE_SEARCH'` * * Generated from protobuf field string filter = 4; * @param string $var diff --git a/DiscoveryEngine/src/V1/ListDocumentsRequest.php b/DiscoveryEngine/src/V1/ListDocumentsRequest.php index 11df71d42554..42d68af993e2 100644 --- a/DiscoveryEngine/src/V1/ListDocumentsRequest.php +++ b/DiscoveryEngine/src/V1/ListDocumentsRequest.php @@ -33,7 +33,7 @@ class ListDocumentsRequest extends \Google\Protobuf\Internal\Message /** * Maximum number of [Document][google.cloud.discoveryengine.v1.Document]s to * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. + * Values above 1000 are set to 1000. * If this field is negative, an `INVALID_ARGUMENT` error is returned. * * Generated from protobuf field int32 page_size = 2; @@ -94,7 +94,7 @@ public static function build(string $parent): self * @type int $page_size * Maximum number of [Document][google.cloud.discoveryengine.v1.Document]s to * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. + * Values above 1000 are set to 1000. * If this field is negative, an `INVALID_ARGUMENT` error is returned. * @type string $page_token * A page token @@ -156,7 +156,7 @@ public function setParent($var) /** * Maximum number of [Document][google.cloud.discoveryengine.v1.Document]s to * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. + * Values above 1000 are set to 1000. * If this field is negative, an `INVALID_ARGUMENT` error is returned. * * Generated from protobuf field int32 page_size = 2; @@ -170,7 +170,7 @@ public function getPageSize() /** * Maximum number of [Document][google.cloud.discoveryengine.v1.Document]s to * return. If unspecified, defaults to 100. The maximum allowed value is 1000. - * Values above 1000 will be coerced to 1000. + * Values above 1000 are set to 1000. * If this field is negative, an `INVALID_ARGUMENT` error is returned. * * Generated from protobuf field int32 page_size = 2; diff --git a/DiscoveryEngine/src/V1/ListSchemasRequest.php b/DiscoveryEngine/src/V1/ListSchemasRequest.php index d627a855cfeb..4a3e130261ec 100644 --- a/DiscoveryEngine/src/V1/ListSchemasRequest.php +++ b/DiscoveryEngine/src/V1/ListSchemasRequest.php @@ -28,8 +28,8 @@ class ListSchemasRequest extends \Google\Protobuf\Internal\Message * The maximum number of [Schema][google.cloud.discoveryengine.v1.Schema]s to * return. The service may return fewer than this value. * If unspecified, at most 100 - * [Schema][google.cloud.discoveryengine.v1.Schema]s will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * [Schema][google.cloud.discoveryengine.v1.Schema]s are returned. + * The maximum value is 1000; values above 1000 are set to 1000. * * Generated from protobuf field int32 page_size = 2; */ @@ -74,8 +74,8 @@ public static function build(string $parent): self * The maximum number of [Schema][google.cloud.discoveryengine.v1.Schema]s to * return. The service may return fewer than this value. * If unspecified, at most 100 - * [Schema][google.cloud.discoveryengine.v1.Schema]s will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * [Schema][google.cloud.discoveryengine.v1.Schema]s are returned. + * The maximum value is 1000; values above 1000 are set to 1000. * @type string $page_token * A page token, received from a previous * [SchemaService.ListSchemas][google.cloud.discoveryengine.v1.SchemaService.ListSchemas] @@ -122,8 +122,8 @@ public function setParent($var) * The maximum number of [Schema][google.cloud.discoveryengine.v1.Schema]s to * return. The service may return fewer than this value. * If unspecified, at most 100 - * [Schema][google.cloud.discoveryengine.v1.Schema]s will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * [Schema][google.cloud.discoveryengine.v1.Schema]s are returned. + * The maximum value is 1000; values above 1000 are set to 1000. * * Generated from protobuf field int32 page_size = 2; * @return int @@ -137,8 +137,8 @@ public function getPageSize() * The maximum number of [Schema][google.cloud.discoveryengine.v1.Schema]s to * return. The service may return fewer than this value. * If unspecified, at most 100 - * [Schema][google.cloud.discoveryengine.v1.Schema]s will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * [Schema][google.cloud.discoveryengine.v1.Schema]s are returned. + * The maximum value is 1000; values above 1000 are set to 1000. * * Generated from protobuf field int32 page_size = 2; * @param int $var diff --git a/DiscoveryEngine/src/V1/ListSessionsRequest.php b/DiscoveryEngine/src/V1/ListSessionsRequest.php new file mode 100644 index 000000000000..ce9a4ffb95c8 --- /dev/null +++ b/DiscoveryEngine/src/V1/ListSessionsRequest.php @@ -0,0 +1,274 @@ +google.cloud.discoveryengine.v1.ListSessionsRequest + */ +class ListSessionsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * + * Generated from protobuf field int32 page_size = 2; + */ + protected $page_size = 0; + /** + * A page token, received from a previous `ListSessions` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3; + */ + protected $page_token = ''; + /** + * A filter to apply on the list results. The supported features are: + * user_pseudo_id, state. + * Example: + * "user_pseudo_id = some_id" + * + * Generated from protobuf field string filter = 4; + */ + protected $filter = ''; + /** + * A comma-separated list of fields to order by, sorted in ascending order. + * Use "desc" after a field name for descending. + * Supported fields: + * * `update_time` + * * `create_time` + * * `session_name` + * Example: + * "update_time desc" + * "create_time" + * + * Generated from protobuf field string order_by = 5; + */ + protected $order_by = ''; + + /** + * @param string $parent Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}` + * Please see {@see ConversationalSearchServiceClient::dataStoreName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1\ListSessionsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}` + * @type int $page_size + * Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @type string $page_token + * A page token, received from a previous `ListSessions` call. + * Provide this to retrieve the subsequent page. + * @type string $filter + * A filter to apply on the list results. The supported features are: + * user_pseudo_id, state. + * Example: + * "user_pseudo_id = some_id" + * @type string $order_by + * A comma-separated list of fields to order by, sorted in ascending order. + * Use "desc" after a field name for descending. + * Supported fields: + * * `update_time` + * * `create_time` + * * `session_name` + * Example: + * "update_time desc" + * "create_time" + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection}/dataStores/{data_store_id}` + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * + * Generated from protobuf field int32 page_size = 2; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * A page token, received from a previous `ListSessions` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * A page token, received from a previous `ListSessions` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * A filter to apply on the list results. The supported features are: + * user_pseudo_id, state. + * Example: + * "user_pseudo_id = some_id" + * + * Generated from protobuf field string filter = 4; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * A filter to apply on the list results. The supported features are: + * user_pseudo_id, state. + * Example: + * "user_pseudo_id = some_id" + * + * Generated from protobuf field string filter = 4; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * A comma-separated list of fields to order by, sorted in ascending order. + * Use "desc" after a field name for descending. + * Supported fields: + * * `update_time` + * * `create_time` + * * `session_name` + * Example: + * "update_time desc" + * "create_time" + * + * Generated from protobuf field string order_by = 5; + * @return string + */ + public function getOrderBy() + { + return $this->order_by; + } + + /** + * A comma-separated list of fields to order by, sorted in ascending order. + * Use "desc" after a field name for descending. + * Supported fields: + * * `update_time` + * * `create_time` + * * `session_name` + * Example: + * "update_time desc" + * "create_time" + * + * Generated from protobuf field string order_by = 5; + * @param string $var + * @return $this + */ + public function setOrderBy($var) + { + GPBUtil::checkString($var, True); + $this->order_by = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/ListSessionsResponse.php b/DiscoveryEngine/src/V1/ListSessionsResponse.php new file mode 100644 index 000000000000..118e667831b1 --- /dev/null +++ b/DiscoveryEngine/src/V1/ListSessionsResponse.php @@ -0,0 +1,101 @@ +google.cloud.discoveryengine.v1.ListSessionsResponse + */ +class ListSessionsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * All the Sessions for a given data store. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Session sessions = 1; + */ + private $sessions; + /** + * Pagination token, if not returned indicates the last page. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DiscoveryEngine\V1\Session>|\Google\Protobuf\Internal\RepeatedField $sessions + * All the Sessions for a given data store. + * @type string $next_page_token + * Pagination token, if not returned indicates the last page. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * All the Sessions for a given data store. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Session sessions = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSessions() + { + return $this->sessions; + } + + /** + * All the Sessions for a given data store. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Session sessions = 1; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Session>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSessions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Session::class); + $this->sessions = $arr; + + return $this; + } + + /** + * Pagination token, if not returned indicates the last page. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Pagination token, if not returned indicates the last page. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/Project.php b/DiscoveryEngine/src/V1/Project.php new file mode 100644 index 000000000000..bb68bc5df75e --- /dev/null +++ b/DiscoveryEngine/src/V1/Project.php @@ -0,0 +1,213 @@ +google.cloud.discoveryengine.v1.Project + */ +class Project extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Full resource name of the project, for example + * `projects/{project_number}`. + * Note that when making requests, project number and project id are both + * acceptable, but the server will always respond in project number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. The timestamp when this project is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when this project is successfully provisioned. + * Empty value means this project is still provisioning and is not ready for + * use. + * + * Generated from protobuf field .google.protobuf.Timestamp provision_completion_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $provision_completion_time = null; + /** + * Output only. A map of terms of services. The key is the `id` of + * [ServiceTerms][google.cloud.discoveryengine.v1.Project.ServiceTerms]. + * + * Generated from protobuf field map service_terms_map = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $service_terms_map; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Full resource name of the project, for example + * `projects/{project_number}`. + * Note that when making requests, project number and project id are both + * acceptable, but the server will always respond in project number. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when this project is created. + * @type \Google\Protobuf\Timestamp $provision_completion_time + * Output only. The timestamp when this project is successfully provisioned. + * Empty value means this project is still provisioning and is not ready for + * use. + * @type array|\Google\Protobuf\Internal\MapField $service_terms_map + * Output only. A map of terms of services. The key is the `id` of + * [ServiceTerms][google.cloud.discoveryengine.v1.Project.ServiceTerms]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Project::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Full resource name of the project, for example + * `projects/{project_number}`. + * Note that when making requests, project number and project id are both + * acceptable, but the server will always respond in project number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Full resource name of the project, for example + * `projects/{project_number}`. + * Note that when making requests, project number and project id are both + * acceptable, but the server will always respond in project number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The timestamp when this project is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when this project is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when this project is successfully provisioned. + * Empty value means this project is still provisioning and is not ready for + * use. + * + * Generated from protobuf field .google.protobuf.Timestamp provision_completion_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getProvisionCompletionTime() + { + return $this->provision_completion_time; + } + + public function hasProvisionCompletionTime() + { + return isset($this->provision_completion_time); + } + + public function clearProvisionCompletionTime() + { + unset($this->provision_completion_time); + } + + /** + * Output only. The timestamp when this project is successfully provisioned. + * Empty value means this project is still provisioning and is not ready for + * use. + * + * Generated from protobuf field .google.protobuf.Timestamp provision_completion_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setProvisionCompletionTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->provision_completion_time = $var; + + return $this; + } + + /** + * Output only. A map of terms of services. The key is the `id` of + * [ServiceTerms][google.cloud.discoveryengine.v1.Project.ServiceTerms]. + * + * Generated from protobuf field map service_terms_map = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getServiceTermsMap() + { + return $this->service_terms_map; + } + + /** + * Output only. A map of terms of services. The key is the `id` of + * [ServiceTerms][google.cloud.discoveryengine.v1.Project.ServiceTerms]. + * + * Generated from protobuf field map service_terms_map = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setServiceTermsMap($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Project\ServiceTerms::class); + $this->service_terms_map = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/Project/ServiceTerms.php b/DiscoveryEngine/src/V1/Project/ServiceTerms.php new file mode 100644 index 000000000000..ddd7a44c991f --- /dev/null +++ b/DiscoveryEngine/src/V1/Project/ServiceTerms.php @@ -0,0 +1,264 @@ +google.cloud.discoveryengine.v1.Project.ServiceTerms + */ +class ServiceTerms extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of this terms of service. + * Available terms: + * * `GA_DATA_USE_TERMS`: [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). When using this as + * `id`, the acceptable + * [version][google.cloud.discoveryengine.v1.Project.ServiceTerms.version] + * to provide is `2022-11-23`. + * + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + /** + * The version string of the terms of service. + * For acceptable values, see the comments for + * [id][google.cloud.discoveryengine.v1.Project.ServiceTerms.id] above. + * + * Generated from protobuf field string version = 2; + */ + protected $version = ''; + /** + * Whether the project has accepted/rejected the service terms or it is + * still pending. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Project.ServiceTerms.State state = 4; + */ + protected $state = 0; + /** + * The last time when the project agreed to the terms of service. + * + * Generated from protobuf field .google.protobuf.Timestamp accept_time = 5; + */ + protected $accept_time = null; + /** + * The last time when the project declined or revoked the agreement to terms + * of service. + * + * Generated from protobuf field .google.protobuf.Timestamp decline_time = 6; + */ + protected $decline_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * The unique identifier of this terms of service. + * Available terms: + * * `GA_DATA_USE_TERMS`: [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). When using this as + * `id`, the acceptable + * [version][google.cloud.discoveryengine.v1.Project.ServiceTerms.version] + * to provide is `2022-11-23`. + * @type string $version + * The version string of the terms of service. + * For acceptable values, see the comments for + * [id][google.cloud.discoveryengine.v1.Project.ServiceTerms.id] above. + * @type int $state + * Whether the project has accepted/rejected the service terms or it is + * still pending. + * @type \Google\Protobuf\Timestamp $accept_time + * The last time when the project agreed to the terms of service. + * @type \Google\Protobuf\Timestamp $decline_time + * The last time when the project declined or revoked the agreement to terms + * of service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Project::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of this terms of service. + * Available terms: + * * `GA_DATA_USE_TERMS`: [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). When using this as + * `id`, the acceptable + * [version][google.cloud.discoveryengine.v1.Project.ServiceTerms.version] + * to provide is `2022-11-23`. + * + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * The unique identifier of this terms of service. + * Available terms: + * * `GA_DATA_USE_TERMS`: [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). When using this as + * `id`, the acceptable + * [version][google.cloud.discoveryengine.v1.Project.ServiceTerms.version] + * to provide is `2022-11-23`. + * + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The version string of the terms of service. + * For acceptable values, see the comments for + * [id][google.cloud.discoveryengine.v1.Project.ServiceTerms.id] above. + * + * Generated from protobuf field string version = 2; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The version string of the terms of service. + * For acceptable values, see the comments for + * [id][google.cloud.discoveryengine.v1.Project.ServiceTerms.id] above. + * + * Generated from protobuf field string version = 2; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Whether the project has accepted/rejected the service terms or it is + * still pending. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Project.ServiceTerms.State state = 4; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Whether the project has accepted/rejected the service terms or it is + * still pending. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Project.ServiceTerms.State state = 4; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DiscoveryEngine\V1\Project\ServiceTerms\State::class); + $this->state = $var; + + return $this; + } + + /** + * The last time when the project agreed to the terms of service. + * + * Generated from protobuf field .google.protobuf.Timestamp accept_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getAcceptTime() + { + return $this->accept_time; + } + + public function hasAcceptTime() + { + return isset($this->accept_time); + } + + public function clearAcceptTime() + { + unset($this->accept_time); + } + + /** + * The last time when the project agreed to the terms of service. + * + * Generated from protobuf field .google.protobuf.Timestamp accept_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setAcceptTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->accept_time = $var; + + return $this; + } + + /** + * The last time when the project declined or revoked the agreement to terms + * of service. + * + * Generated from protobuf field .google.protobuf.Timestamp decline_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeclineTime() + { + return $this->decline_time; + } + + public function hasDeclineTime() + { + return isset($this->decline_time); + } + + public function clearDeclineTime() + { + unset($this->decline_time); + } + + /** + * The last time when the project declined or revoked the agreement to terms + * of service. + * + * Generated from protobuf field .google.protobuf.Timestamp decline_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeclineTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->decline_time = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/Project/ServiceTerms/State.php b/DiscoveryEngine/src/V1/Project/ServiceTerms/State.php new file mode 100644 index 000000000000..a41802e86321 --- /dev/null +++ b/DiscoveryEngine/src/V1/Project/ServiceTerms/State.php @@ -0,0 +1,69 @@ +google.cloud.discoveryengine.v1.Project.ServiceTerms.State + */ +class State +{ + /** + * The default value of the enum. This value is not actually used. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The project has given consent to the terms of service. + * + * Generated from protobuf enum TERMS_ACCEPTED = 1; + */ + const TERMS_ACCEPTED = 1; + /** + * The project is pending to review and accept the terms of service. + * + * Generated from protobuf enum TERMS_PENDING = 2; + */ + const TERMS_PENDING = 2; + /** + * The project has declined or revoked the agreement to terms of service. + * + * Generated from protobuf enum TERMS_DECLINED = 3; + */ + const TERMS_DECLINED = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::TERMS_ACCEPTED => 'TERMS_ACCEPTED', + self::TERMS_PENDING => 'TERMS_PENDING', + self::TERMS_DECLINED => 'TERMS_DECLINED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DiscoveryEngine/src/V1/ProvisionProjectMetadata.php b/DiscoveryEngine/src/V1/ProvisionProjectMetadata.php new file mode 100644 index 000000000000..95f9296757ae --- /dev/null +++ b/DiscoveryEngine/src/V1/ProvisionProjectMetadata.php @@ -0,0 +1,33 @@ +google.cloud.discoveryengine.v1.ProvisionProjectMetadata + */ +class ProvisionProjectMetadata extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ProjectService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/DiscoveryEngine/src/V1/ProvisionProjectRequest.php b/DiscoveryEngine/src/V1/ProvisionProjectRequest.php new file mode 100644 index 000000000000..51a94f5db321 --- /dev/null +++ b/DiscoveryEngine/src/V1/ProvisionProjectRequest.php @@ -0,0 +1,181 @@ +google.cloud.discoveryengine.v1.ProvisionProjectRequest + */ +class ProvisionProjectRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Full resource name of a + * [Project][google.cloud.discoveryengine.v1.Project], such as + * `projects/{project_id_or_number}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. Set to `true` to specify that caller has read and would like to + * give consent to the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). + * + * Generated from protobuf field bool accept_data_use_terms = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $accept_data_use_terms = false; + /** + * Required. The version of the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms) that caller has read + * and would like to give consent to. + * Acceptable version is `2022-11-23`, and this may change over time. + * + * Generated from protobuf field string data_use_terms_version = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data_use_terms_version = ''; + + /** + * @param string $name Required. Full resource name of a + * [Project][google.cloud.discoveryengine.v1.Project], such as + * `projects/{project_id_or_number}`. Please see + * {@see ProjectServiceClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1\ProvisionProjectRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Full resource name of a + * [Project][google.cloud.discoveryengine.v1.Project], such as + * `projects/{project_id_or_number}`. + * @type bool $accept_data_use_terms + * Required. Set to `true` to specify that caller has read and would like to + * give consent to the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). + * @type string $data_use_terms_version + * Required. The version of the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms) that caller has read + * and would like to give consent to. + * Acceptable version is `2022-11-23`, and this may change over time. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ProjectService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Full resource name of a + * [Project][google.cloud.discoveryengine.v1.Project], such as + * `projects/{project_id_or_number}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Full resource name of a + * [Project][google.cloud.discoveryengine.v1.Project], such as + * `projects/{project_id_or_number}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. Set to `true` to specify that caller has read and would like to + * give consent to the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). + * + * Generated from protobuf field bool accept_data_use_terms = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return bool + */ + public function getAcceptDataUseTerms() + { + return $this->accept_data_use_terms; + } + + /** + * Required. Set to `true` to specify that caller has read and would like to + * give consent to the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). + * + * Generated from protobuf field bool accept_data_use_terms = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param bool $var + * @return $this + */ + public function setAcceptDataUseTerms($var) + { + GPBUtil::checkBool($var); + $this->accept_data_use_terms = $var; + + return $this; + } + + /** + * Required. The version of the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms) that caller has read + * and would like to give consent to. + * Acceptable version is `2022-11-23`, and this may change over time. + * + * Generated from protobuf field string data_use_terms_version = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDataUseTermsVersion() + { + return $this->data_use_terms_version; + } + + /** + * Required. The version of the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms) that caller has read + * and would like to give consent to. + * Acceptable version is `2022-11-23`, and this may change over time. + * + * Generated from protobuf field string data_use_terms_version = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDataUseTermsVersion($var) + { + GPBUtil::checkString($var, True); + $this->data_use_terms_version = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/Query.php b/DiscoveryEngine/src/V1/Query.php new file mode 100644 index 000000000000..e6c4300bb212 --- /dev/null +++ b/DiscoveryEngine/src/V1/Query.php @@ -0,0 +1,109 @@ +google.cloud.discoveryengine.v1.Query + */ +class Query extends \Google\Protobuf\Internal\Message +{ + /** + * Unique Id for the query. + * + * Generated from protobuf field string query_id = 1; + */ + protected $query_id = ''; + protected $content; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $text + * Plain text. + * @type string $query_id + * Unique Id for the query. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Session::initOnce(); + parent::__construct($data); + } + + /** + * Plain text. + * + * Generated from protobuf field string text = 2; + * @return string + */ + public function getText() + { + return $this->readOneof(2); + } + + public function hasText() + { + return $this->hasOneof(2); + } + + /** + * Plain text. + * + * Generated from protobuf field string text = 2; + * @param string $var + * @return $this + */ + public function setText($var) + { + GPBUtil::checkString($var, True); + $this->writeOneof(2, $var); + + return $this; + } + + /** + * Unique Id for the query. + * + * Generated from protobuf field string query_id = 1; + * @return string + */ + public function getQueryId() + { + return $this->query_id; + } + + /** + * Unique Id for the query. + * + * Generated from protobuf field string query_id = 1; + * @param string $var + * @return $this + */ + public function setQueryId($var) + { + GPBUtil::checkString($var, True); + $this->query_id = $var; + + return $this; + } + + /** + * @return string + */ + public function getContent() + { + return $this->whichOneof("content"); + } + +} + diff --git a/DiscoveryEngine/src/V1/RankRequest.php b/DiscoveryEngine/src/V1/RankRequest.php new file mode 100644 index 000000000000..2a243f093ecb --- /dev/null +++ b/DiscoveryEngine/src/V1/RankRequest.php @@ -0,0 +1,352 @@ +google.cloud.discoveryengine.v1.RankRequest + */ +class RankRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the rank service config, such as + * `projects/{project_num}/locations/{location_id}/rankingConfigs/default_ranking_config`. + * + * Generated from protobuf field string ranking_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $ranking_config = ''; + /** + * The identifier of the model to use. It is one of: + * * `semantic-ranker-512@latest`: Semantic ranking model with maxiumn input + * token size 512. + * It is set to `semantic-ranker-512@latest` by default if unspecified. + * + * Generated from protobuf field string model = 2; + */ + protected $model = ''; + /** + * The number of results to return. If this is unset or no bigger than zero, + * returns all results. + * + * Generated from protobuf field int32 top_n = 3; + */ + protected $top_n = 0; + /** + * The query to use. + * + * Generated from protobuf field string query = 4; + */ + protected $query = ''; + /** + * Required. A list of records to rank. At most 200 records to rank. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED]; + */ + private $records; + /** + * If true, the response will contain only record ID and score. By default, it + * is false, the response will contain record details. + * + * Generated from protobuf field bool ignore_record_details_in_response = 6; + */ + protected $ignore_record_details_in_response = false; + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 7; + */ + private $user_labels; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $ranking_config + * Required. The resource name of the rank service config, such as + * `projects/{project_num}/locations/{location_id}/rankingConfigs/default_ranking_config`. + * @type string $model + * The identifier of the model to use. It is one of: + * * `semantic-ranker-512@latest`: Semantic ranking model with maxiumn input + * token size 512. + * It is set to `semantic-ranker-512@latest` by default if unspecified. + * @type int $top_n + * The number of results to return. If this is unset or no bigger than zero, + * returns all results. + * @type string $query + * The query to use. + * @type array<\Google\Cloud\DiscoveryEngine\V1\RankingRecord>|\Google\Protobuf\Internal\RepeatedField $records + * Required. A list of records to rank. At most 200 records to rank. + * @type bool $ignore_record_details_in_response + * If true, the response will contain only record ID and score. By default, it + * is false, the response will contain record details. + * @type array|\Google\Protobuf\Internal\MapField $user_labels + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\RankService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the rank service config, such as + * `projects/{project_num}/locations/{location_id}/rankingConfigs/default_ranking_config`. + * + * Generated from protobuf field string ranking_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getRankingConfig() + { + return $this->ranking_config; + } + + /** + * Required. The resource name of the rank service config, such as + * `projects/{project_num}/locations/{location_id}/rankingConfigs/default_ranking_config`. + * + * Generated from protobuf field string ranking_config = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setRankingConfig($var) + { + GPBUtil::checkString($var, True); + $this->ranking_config = $var; + + return $this; + } + + /** + * The identifier of the model to use. It is one of: + * * `semantic-ranker-512@latest`: Semantic ranking model with maxiumn input + * token size 512. + * It is set to `semantic-ranker-512@latest` by default if unspecified. + * + * Generated from protobuf field string model = 2; + * @return string + */ + public function getModel() + { + return $this->model; + } + + /** + * The identifier of the model to use. It is one of: + * * `semantic-ranker-512@latest`: Semantic ranking model with maxiumn input + * token size 512. + * It is set to `semantic-ranker-512@latest` by default if unspecified. + * + * Generated from protobuf field string model = 2; + * @param string $var + * @return $this + */ + public function setModel($var) + { + GPBUtil::checkString($var, True); + $this->model = $var; + + return $this; + } + + /** + * The number of results to return. If this is unset or no bigger than zero, + * returns all results. + * + * Generated from protobuf field int32 top_n = 3; + * @return int + */ + public function getTopN() + { + return $this->top_n; + } + + /** + * The number of results to return. If this is unset or no bigger than zero, + * returns all results. + * + * Generated from protobuf field int32 top_n = 3; + * @param int $var + * @return $this + */ + public function setTopN($var) + { + GPBUtil::checkInt32($var); + $this->top_n = $var; + + return $this; + } + + /** + * The query to use. + * + * Generated from protobuf field string query = 4; + * @return string + */ + public function getQuery() + { + return $this->query; + } + + /** + * The query to use. + * + * Generated from protobuf field string query = 4; + * @param string $var + * @return $this + */ + public function setQuery($var) + { + GPBUtil::checkString($var, True); + $this->query = $var; + + return $this; + } + + /** + * Required. A list of records to rank. At most 200 records to rank. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRecords() + { + return $this->records; + } + + /** + * Required. A list of records to rank. At most 200 records to rank. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5 [(.google.api.field_behavior) = REQUIRED]; + * @param array<\Google\Cloud\DiscoveryEngine\V1\RankingRecord>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRecords($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\RankingRecord::class); + $this->records = $arr; + + return $this; + } + + /** + * If true, the response will contain only record ID and score. By default, it + * is false, the response will contain record details. + * + * Generated from protobuf field bool ignore_record_details_in_response = 6; + * @return bool + */ + public function getIgnoreRecordDetailsInResponse() + { + return $this->ignore_record_details_in_response; + } + + /** + * If true, the response will contain only record ID and score. By default, it + * is false, the response will contain record details. + * + * Generated from protobuf field bool ignore_record_details_in_response = 6; + * @param bool $var + * @return $this + */ + public function setIgnoreRecordDetailsInResponse($var) + { + GPBUtil::checkBool($var); + $this->ignore_record_details_in_response = $var; + + return $this; + } + + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getUserLabels() + { + return $this->user_labels; + } + + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 7; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setUserLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->user_labels = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/RankResponse.php b/DiscoveryEngine/src/V1/RankResponse.php new file mode 100644 index 000000000000..d03a029e4612 --- /dev/null +++ b/DiscoveryEngine/src/V1/RankResponse.php @@ -0,0 +1,68 @@ +google.cloud.discoveryengine.v1.RankResponse + */ +class RankResponse extends \Google\Protobuf\Internal\Message +{ + /** + * A list of records sorted by descending score. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5; + */ + private $records; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DiscoveryEngine\V1\RankingRecord>|\Google\Protobuf\Internal\RepeatedField $records + * A list of records sorted by descending score. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\RankService::initOnce(); + parent::__construct($data); + } + + /** + * A list of records sorted by descending score. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getRecords() + { + return $this->records; + } + + /** + * A list of records sorted by descending score. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.RankingRecord records = 5; + * @param array<\Google\Cloud\DiscoveryEngine\V1\RankingRecord>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setRecords($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\RankingRecord::class); + $this->records = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/RankingRecord.php b/DiscoveryEngine/src/V1/RankingRecord.php new file mode 100644 index 000000000000..5c907094e8d2 --- /dev/null +++ b/DiscoveryEngine/src/V1/RankingRecord.php @@ -0,0 +1,202 @@ +google.cloud.discoveryengine.v1.RankingRecord + */ +class RankingRecord extends \Google\Protobuf\Internal\Message +{ + /** + * The unique ID to represent the record. + * + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + /** + * The title of the record. Empty by default. + * At least one of + * [title][google.cloud.discoveryengine.v1.RankingRecord.title] or + * [content][google.cloud.discoveryengine.v1.RankingRecord.content] should be + * set otherwise an INVALID_ARGUMENT error is thrown. + * + * Generated from protobuf field string title = 2; + */ + protected $title = ''; + /** + * The content of the record. Empty by default. + * At least one of + * [title][google.cloud.discoveryengine.v1.RankingRecord.title] or + * [content][google.cloud.discoveryengine.v1.RankingRecord.content] should be + * set otherwise an INVALID_ARGUMENT error is thrown. + * + * Generated from protobuf field string content = 3; + */ + protected $content = ''; + /** + * The score of this record based on the given query and selected model. + * + * Generated from protobuf field float score = 4; + */ + protected $score = 0.0; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * The unique ID to represent the record. + * @type string $title + * The title of the record. Empty by default. + * At least one of + * [title][google.cloud.discoveryengine.v1.RankingRecord.title] or + * [content][google.cloud.discoveryengine.v1.RankingRecord.content] should be + * set otherwise an INVALID_ARGUMENT error is thrown. + * @type string $content + * The content of the record. Empty by default. + * At least one of + * [title][google.cloud.discoveryengine.v1.RankingRecord.title] or + * [content][google.cloud.discoveryengine.v1.RankingRecord.content] should be + * set otherwise an INVALID_ARGUMENT error is thrown. + * @type float $score + * The score of this record based on the given query and selected model. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\RankService::initOnce(); + parent::__construct($data); + } + + /** + * The unique ID to represent the record. + * + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * The unique ID to represent the record. + * + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The title of the record. Empty by default. + * At least one of + * [title][google.cloud.discoveryengine.v1.RankingRecord.title] or + * [content][google.cloud.discoveryengine.v1.RankingRecord.content] should be + * set otherwise an INVALID_ARGUMENT error is thrown. + * + * Generated from protobuf field string title = 2; + * @return string + */ + public function getTitle() + { + return $this->title; + } + + /** + * The title of the record. Empty by default. + * At least one of + * [title][google.cloud.discoveryengine.v1.RankingRecord.title] or + * [content][google.cloud.discoveryengine.v1.RankingRecord.content] should be + * set otherwise an INVALID_ARGUMENT error is thrown. + * + * Generated from protobuf field string title = 2; + * @param string $var + * @return $this + */ + public function setTitle($var) + { + GPBUtil::checkString($var, True); + $this->title = $var; + + return $this; + } + + /** + * The content of the record. Empty by default. + * At least one of + * [title][google.cloud.discoveryengine.v1.RankingRecord.title] or + * [content][google.cloud.discoveryengine.v1.RankingRecord.content] should be + * set otherwise an INVALID_ARGUMENT error is thrown. + * + * Generated from protobuf field string content = 3; + * @return string + */ + public function getContent() + { + return $this->content; + } + + /** + * The content of the record. Empty by default. + * At least one of + * [title][google.cloud.discoveryengine.v1.RankingRecord.title] or + * [content][google.cloud.discoveryengine.v1.RankingRecord.content] should be + * set otherwise an INVALID_ARGUMENT error is thrown. + * + * Generated from protobuf field string content = 3; + * @param string $var + * @return $this + */ + public function setContent($var) + { + GPBUtil::checkString($var, True); + $this->content = $var; + + return $this; + } + + /** + * The score of this record based on the given query and selected model. + * + * Generated from protobuf field float score = 4; + * @return float + */ + public function getScore() + { + return $this->score; + } + + /** + * The score of this record based on the given query and selected model. + * + * Generated from protobuf field float score = 4; + * @param float $var + * @return $this + */ + public function setScore($var) + { + GPBUtil::checkFloat($var); + $this->score = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/RecommendRequest.php b/DiscoveryEngine/src/V1/RecommendRequest.php index 60a6de5550df..9e45b718daf4 100644 --- a/DiscoveryEngine/src/V1/RecommendRequest.php +++ b/DiscoveryEngine/src/V1/RecommendRequest.php @@ -20,7 +20,7 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message * `projects/*/locations/global/collections/*/engines/*/servingConfigs/*`, or * `projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*` * One default serving config is created along with your recommendation engine - * creation. The engine ID will be used as the ID of the default serving + * creation. The engine ID is used as the ID of the default serving * config. For example, for Engine * `projects/*/locations/global/collections/*/engines/my-engine`, you can use * `projects/*/locations/global/collections/*/engines/my-engine/servingConfigs/my-engine` @@ -53,9 +53,9 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message protected $user_event = null; /** * Maximum number of results to return. Set this property - * to the number of recommendation results needed. If zero, the service will - * choose a reasonable default. The maximum allowed value is 100. Values - * above 100 will be coerced to 100. + * to the number of recommendation results needed. If zero, the service + * chooses a reasonable default. The maximum allowed value is 100. Values + * above 100 are set to 100. * * Generated from protobuf field int32 page_size = 3; */ @@ -73,21 +73,21 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message * * (launguage: ANY("en", "es")) AND NOT (categories: ANY("Movie")) * * (available: true) AND * (launguage: ANY("en", "es")) OR (categories: ANY("Movie")) - * If your filter blocks all results, the API will return generic + * If your filter blocks all results, the API returns generic * (unfiltered) popular Documents. If you only want results strictly matching - * the filters, set `strictFiltering` to True in + * the filters, set `strictFiltering` to `true` in * [RecommendRequest.params][google.cloud.discoveryengine.v1.RecommendRequest.params] * to receive empty results instead. - * Note that the API will never return + * Note that the API never returns * [Document][google.cloud.discoveryengine.v1.Document]s with `storageStatus` - * of `EXPIRED` or `DELETED` regardless of filter choices. + * as `EXPIRED` or `DELETED` regardless of filter choices. * * Generated from protobuf field string filter = 4; */ protected $filter = ''; /** - * Use validate only mode for this recommendation query. If set to true, a - * fake model will be used that returns arbitrary Document IDs. + * Use validate only mode for this recommendation query. If set to `true`, a + * fake model is used that returns arbitrary Document IDs. * Note that the validate only mode should only be used for testing the API, * or if the model is not ready. * @@ -97,16 +97,17 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message /** * Additional domain specific parameters for the recommendations. * Allowed values: - * * `returnDocument`: Boolean. If set to true, the associated Document - * object will be returned in + * * `returnDocument`: Boolean. If set to `true`, the associated Document + * object is returned in * [RecommendResponse.RecommendationResult.document][google.cloud.discoveryengine.v1.RecommendResponse.RecommendationResult.document]. - * * `returnScore`: Boolean. If set to true, the recommendation 'score' - * corresponding to each returned Document will be set in + * * `returnScore`: Boolean. If set to true, the recommendation score + * corresponding to each returned Document is set in * [RecommendResponse.RecommendationResult.metadata][google.cloud.discoveryengine.v1.RecommendResponse.RecommendationResult.metadata]. - * The given 'score' indicates the probability of a Document conversion - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular Documents instead of empty if + * The given score indicates the probability of a Document conversion given + * the user's context and history. + * * `strictFiltering`: Boolean. True by default. If set to `false`, the + * service + * returns generic (unfiltered) popular Documents instead of empty if * your filter blocks all recommendation results. * * `diversityLevel`: String. Default empty. If set to be non-empty, then * it needs to be one of: @@ -156,7 +157,7 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message * `projects/*/locations/global/collections/*/engines/*/servingConfigs/*`, or * `projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*` * One default serving config is created along with your recommendation engine - * creation. The engine ID will be used as the ID of the default serving + * creation. The engine ID is used as the ID of the default serving * config. For example, for Engine * `projects/*/locations/global/collections/*/engines/my-engine`, you can use * `projects/*/locations/global/collections/*/engines/my-engine/servingConfigs/my-engine` @@ -181,9 +182,9 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message * unset. * @type int $page_size * Maximum number of results to return. Set this property - * to the number of recommendation results needed. If zero, the service will - * choose a reasonable default. The maximum allowed value is 100. Values - * above 100 will be coerced to 100. + * to the number of recommendation results needed. If zero, the service + * chooses a reasonable default. The maximum allowed value is 100. Values + * above 100 are set to 100. * @type string $filter * Filter for restricting recommendation results with a length limit of 5,000 * characters. Currently, only filter expressions on the `filter_tags` @@ -197,32 +198,33 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message * * (launguage: ANY("en", "es")) AND NOT (categories: ANY("Movie")) * * (available: true) AND * (launguage: ANY("en", "es")) OR (categories: ANY("Movie")) - * If your filter blocks all results, the API will return generic + * If your filter blocks all results, the API returns generic * (unfiltered) popular Documents. If you only want results strictly matching - * the filters, set `strictFiltering` to True in + * the filters, set `strictFiltering` to `true` in * [RecommendRequest.params][google.cloud.discoveryengine.v1.RecommendRequest.params] * to receive empty results instead. - * Note that the API will never return + * Note that the API never returns * [Document][google.cloud.discoveryengine.v1.Document]s with `storageStatus` - * of `EXPIRED` or `DELETED` regardless of filter choices. + * as `EXPIRED` or `DELETED` regardless of filter choices. * @type bool $validate_only - * Use validate only mode for this recommendation query. If set to true, a - * fake model will be used that returns arbitrary Document IDs. + * Use validate only mode for this recommendation query. If set to `true`, a + * fake model is used that returns arbitrary Document IDs. * Note that the validate only mode should only be used for testing the API, * or if the model is not ready. * @type array|\Google\Protobuf\Internal\MapField $params * Additional domain specific parameters for the recommendations. * Allowed values: - * * `returnDocument`: Boolean. If set to true, the associated Document - * object will be returned in + * * `returnDocument`: Boolean. If set to `true`, the associated Document + * object is returned in * [RecommendResponse.RecommendationResult.document][google.cloud.discoveryengine.v1.RecommendResponse.RecommendationResult.document]. - * * `returnScore`: Boolean. If set to true, the recommendation 'score' - * corresponding to each returned Document will be set in + * * `returnScore`: Boolean. If set to true, the recommendation score + * corresponding to each returned Document is set in * [RecommendResponse.RecommendationResult.metadata][google.cloud.discoveryengine.v1.RecommendResponse.RecommendationResult.metadata]. - * The given 'score' indicates the probability of a Document conversion - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular Documents instead of empty if + * The given score indicates the probability of a Document conversion given + * the user's context and history. + * * `strictFiltering`: Boolean. True by default. If set to `false`, the + * service + * returns generic (unfiltered) popular Documents instead of empty if * your filter blocks all recommendation results. * * `diversityLevel`: String. Default empty. If set to be non-empty, then * it needs to be one of: @@ -264,7 +266,7 @@ public function __construct($data = NULL) { * `projects/*/locations/global/collections/*/engines/*/servingConfigs/*`, or * `projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*` * One default serving config is created along with your recommendation engine - * creation. The engine ID will be used as the ID of the default serving + * creation. The engine ID is used as the ID of the default serving * config. For example, for Engine * `projects/*/locations/global/collections/*/engines/my-engine`, you can use * `projects/*/locations/global/collections/*/engines/my-engine/servingConfigs/my-engine` @@ -285,7 +287,7 @@ public function getServingConfig() * `projects/*/locations/global/collections/*/engines/*/servingConfigs/*`, or * `projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*` * One default serving config is created along with your recommendation engine - * creation. The engine ID will be used as the ID of the default serving + * creation. The engine ID is used as the ID of the default serving * config. For example, for Engine * `projects/*/locations/global/collections/*/engines/my-engine`, you can use * `projects/*/locations/global/collections/*/engines/my-engine/servingConfigs/my-engine` @@ -371,9 +373,9 @@ public function setUserEvent($var) /** * Maximum number of results to return. Set this property - * to the number of recommendation results needed. If zero, the service will - * choose a reasonable default. The maximum allowed value is 100. Values - * above 100 will be coerced to 100. + * to the number of recommendation results needed. If zero, the service + * chooses a reasonable default. The maximum allowed value is 100. Values + * above 100 are set to 100. * * Generated from protobuf field int32 page_size = 3; * @return int @@ -385,9 +387,9 @@ public function getPageSize() /** * Maximum number of results to return. Set this property - * to the number of recommendation results needed. If zero, the service will - * choose a reasonable default. The maximum allowed value is 100. Values - * above 100 will be coerced to 100. + * to the number of recommendation results needed. If zero, the service + * chooses a reasonable default. The maximum allowed value is 100. Values + * above 100 are set to 100. * * Generated from protobuf field int32 page_size = 3; * @param int $var @@ -414,14 +416,14 @@ public function setPageSize($var) * * (launguage: ANY("en", "es")) AND NOT (categories: ANY("Movie")) * * (available: true) AND * (launguage: ANY("en", "es")) OR (categories: ANY("Movie")) - * If your filter blocks all results, the API will return generic + * If your filter blocks all results, the API returns generic * (unfiltered) popular Documents. If you only want results strictly matching - * the filters, set `strictFiltering` to True in + * the filters, set `strictFiltering` to `true` in * [RecommendRequest.params][google.cloud.discoveryengine.v1.RecommendRequest.params] * to receive empty results instead. - * Note that the API will never return + * Note that the API never returns * [Document][google.cloud.discoveryengine.v1.Document]s with `storageStatus` - * of `EXPIRED` or `DELETED` regardless of filter choices. + * as `EXPIRED` or `DELETED` regardless of filter choices. * * Generated from protobuf field string filter = 4; * @return string @@ -444,14 +446,14 @@ public function getFilter() * * (launguage: ANY("en", "es")) AND NOT (categories: ANY("Movie")) * * (available: true) AND * (launguage: ANY("en", "es")) OR (categories: ANY("Movie")) - * If your filter blocks all results, the API will return generic + * If your filter blocks all results, the API returns generic * (unfiltered) popular Documents. If you only want results strictly matching - * the filters, set `strictFiltering` to True in + * the filters, set `strictFiltering` to `true` in * [RecommendRequest.params][google.cloud.discoveryengine.v1.RecommendRequest.params] * to receive empty results instead. - * Note that the API will never return + * Note that the API never returns * [Document][google.cloud.discoveryengine.v1.Document]s with `storageStatus` - * of `EXPIRED` or `DELETED` regardless of filter choices. + * as `EXPIRED` or `DELETED` regardless of filter choices. * * Generated from protobuf field string filter = 4; * @param string $var @@ -466,8 +468,8 @@ public function setFilter($var) } /** - * Use validate only mode for this recommendation query. If set to true, a - * fake model will be used that returns arbitrary Document IDs. + * Use validate only mode for this recommendation query. If set to `true`, a + * fake model is used that returns arbitrary Document IDs. * Note that the validate only mode should only be used for testing the API, * or if the model is not ready. * @@ -480,8 +482,8 @@ public function getValidateOnly() } /** - * Use validate only mode for this recommendation query. If set to true, a - * fake model will be used that returns arbitrary Document IDs. + * Use validate only mode for this recommendation query. If set to `true`, a + * fake model is used that returns arbitrary Document IDs. * Note that the validate only mode should only be used for testing the API, * or if the model is not ready. * @@ -500,16 +502,17 @@ public function setValidateOnly($var) /** * Additional domain specific parameters for the recommendations. * Allowed values: - * * `returnDocument`: Boolean. If set to true, the associated Document - * object will be returned in + * * `returnDocument`: Boolean. If set to `true`, the associated Document + * object is returned in * [RecommendResponse.RecommendationResult.document][google.cloud.discoveryengine.v1.RecommendResponse.RecommendationResult.document]. - * * `returnScore`: Boolean. If set to true, the recommendation 'score' - * corresponding to each returned Document will be set in + * * `returnScore`: Boolean. If set to true, the recommendation score + * corresponding to each returned Document is set in * [RecommendResponse.RecommendationResult.metadata][google.cloud.discoveryengine.v1.RecommendResponse.RecommendationResult.metadata]. - * The given 'score' indicates the probability of a Document conversion - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular Documents instead of empty if + * The given score indicates the probability of a Document conversion given + * the user's context and history. + * * `strictFiltering`: Boolean. True by default. If set to `false`, the + * service + * returns generic (unfiltered) popular Documents instead of empty if * your filter blocks all recommendation results. * * `diversityLevel`: String. Default empty. If set to be non-empty, then * it needs to be one of: @@ -535,16 +538,17 @@ public function getParams() /** * Additional domain specific parameters for the recommendations. * Allowed values: - * * `returnDocument`: Boolean. If set to true, the associated Document - * object will be returned in + * * `returnDocument`: Boolean. If set to `true`, the associated Document + * object is returned in * [RecommendResponse.RecommendationResult.document][google.cloud.discoveryengine.v1.RecommendResponse.RecommendationResult.document]. - * * `returnScore`: Boolean. If set to true, the recommendation 'score' - * corresponding to each returned Document will be set in + * * `returnScore`: Boolean. If set to true, the recommendation score + * corresponding to each returned Document is set in * [RecommendResponse.RecommendationResult.metadata][google.cloud.discoveryengine.v1.RecommendResponse.RecommendationResult.metadata]. - * The given 'score' indicates the probability of a Document conversion - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular Documents instead of empty if + * The given score indicates the probability of a Document conversion given + * the user's context and history. + * * `strictFiltering`: Boolean. True by default. If set to `false`, the + * service + * returns generic (unfiltered) popular Documents instead of empty if * your filter blocks all recommendation results. * * `diversityLevel`: String. Default empty. If set to be non-empty, then * it needs to be one of: diff --git a/DiscoveryEngine/src/V1/RecommendResponse/RecommendationResult.php b/DiscoveryEngine/src/V1/RecommendResponse/RecommendationResult.php index 998dd2b90468..fa8719e71aca 100644 --- a/DiscoveryEngine/src/V1/RecommendResponse/RecommendationResult.php +++ b/DiscoveryEngine/src/V1/RecommendResponse/RecommendationResult.php @@ -30,7 +30,7 @@ class RecommendationResult extends \Google\Protobuf\Internal\Message */ protected $document = null; /** - * Additional Document metadata / annotations. + * Additional Document metadata or annotations. * Possible values: * * `score`: Recommendation score in double value. Is set if * `returnScore` is set to true in @@ -52,7 +52,7 @@ class RecommendationResult extends \Google\Protobuf\Internal\Message * Set if `returnDocument` is set to true in * [RecommendRequest.params][google.cloud.discoveryengine.v1.RecommendRequest.params]. * @type array|\Google\Protobuf\Internal\MapField $metadata - * Additional Document metadata / annotations. + * Additional Document metadata or annotations. * Possible values: * * `score`: Recommendation score in double value. Is set if * `returnScore` is set to true in @@ -129,7 +129,7 @@ public function setDocument($var) } /** - * Additional Document metadata / annotations. + * Additional Document metadata or annotations. * Possible values: * * `score`: Recommendation score in double value. Is set if * `returnScore` is set to true in @@ -144,7 +144,7 @@ public function getMetadata() } /** - * Additional Document metadata / annotations. + * Additional Document metadata or annotations. * Possible values: * * `score`: Recommendation score in double value. Is set if * `returnScore` is set to true in diff --git a/DiscoveryEngine/src/V1/SearchRequest.php b/DiscoveryEngine/src/V1/SearchRequest.php index 891ac3eb8723..a941a9fbb1bd 100644 --- a/DiscoveryEngine/src/V1/SearchRequest.php +++ b/DiscoveryEngine/src/V1/SearchRequest.php @@ -86,7 +86,10 @@ class SearchRequest extends \Google\Protobuf\Internal\Message */ protected $offset = 0; /** - * A list of data store specs to apply on a search call. + * Specs defining dataStores to filter on in a search call and configurations + * for those dataStores. This is only considered for engines with multiple + * dataStores use case. For single dataStore within an engine, they should + * use the specs at the top level. * * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.SearchRequest.DataStoreSpec data_store_specs = 32; */ @@ -127,7 +130,8 @@ class SearchRequest extends \Google\Protobuf\Internal\Message * The order in which documents are returned. Documents can be ordered by * a field in an [Document][google.cloud.discoveryengine.v1.Document] object. * Leave it unset if ordered by relevance. `order_by` expression is - * case-sensitive. For more information on ordering, see + * case-sensitive. + * For more information on ordering for retail search, see * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. * @@ -154,7 +158,7 @@ class SearchRequest extends \Google\Protobuf\Internal\Message /** * Boost specification to boost certain documents. * For more information on boosting, see - * [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results) * * Generated from protobuf field .google.cloud.discoveryengine.v1.SearchRequest.BoostSpec boost_spec = 10; */ @@ -164,15 +168,13 @@ class SearchRequest extends \Google\Protobuf\Internal\Message * For public website search only, supported values are: * * `user_country_code`: string. Default empty. If set to non-empty, results * are restricted or boosted based on the location provided. - * Example: - * user_country_code: "au" + * For example, `user_country_code: "au"` * For available codes see [Country * Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) * * `search_type`: double. Default empty. Enables non-webpage searching * depending on the value. The only valid non-default value is 1, * which enables image searching. - * Example: - * search_type: 1 + * For example, `search_type: 1` * * Generated from protobuf field map params = 11; */ @@ -288,7 +290,10 @@ class SearchRequest extends \Google\Protobuf\Internal\Message * unset. * If this field is negative, an `INVALID_ARGUMENT` is returned. * @type array<\Google\Cloud\DiscoveryEngine\V1\SearchRequest\DataStoreSpec>|\Google\Protobuf\Internal\RepeatedField $data_store_specs - * A list of data store specs to apply on a search call. + * Specs defining dataStores to filter on in a search call and configurations + * for those dataStores. This is only considered for engines with multiple + * dataStores use case. For single dataStore within an engine, they should + * use the specs at the top level. * @type string $filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the documents being filtered. Filter @@ -317,7 +322,8 @@ class SearchRequest extends \Google\Protobuf\Internal\Message * The order in which documents are returned. Documents can be ordered by * a field in an [Document][google.cloud.discoveryengine.v1.Document] object. * Leave it unset if ordered by relevance. `order_by` expression is - * case-sensitive. For more information on ordering, see + * case-sensitive. + * For more information on ordering for retail search, see * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. * @type \Google\Cloud\DiscoveryEngine\V1\UserInfo $user_info @@ -332,21 +338,19 @@ class SearchRequest extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\DiscoveryEngine\V1\SearchRequest\BoostSpec $boost_spec * Boost specification to boost certain documents. * For more information on boosting, see - * [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results) * @type array|\Google\Protobuf\Internal\MapField $params * Additional search parameters. * For public website search only, supported values are: * * `user_country_code`: string. Default empty. If set to non-empty, results * are restricted or boosted based on the location provided. - * Example: - * user_country_code: "au" + * For example, `user_country_code: "au"` * For available codes see [Country * Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) * * `search_type`: double. Default empty. Enables non-webpage searching * depending on the value. The only valid non-default value is 1, * which enables image searching. - * Example: - * search_type: 1 + * For example, `search_type: 1` * @type \Google\Cloud\DiscoveryEngine\V1\SearchRequest\QueryExpansionSpec $query_expansion_spec * The query expansion specification that specifies the conditions under which * query expansion occurs. @@ -638,7 +642,10 @@ public function setOffset($var) } /** - * A list of data store specs to apply on a search call. + * Specs defining dataStores to filter on in a search call and configurations + * for those dataStores. This is only considered for engines with multiple + * dataStores use case. For single dataStore within an engine, they should + * use the specs at the top level. * * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.SearchRequest.DataStoreSpec data_store_specs = 32; * @return \Google\Protobuf\Internal\RepeatedField @@ -649,7 +656,10 @@ public function getDataStoreSpecs() } /** - * A list of data store specs to apply on a search call. + * Specs defining dataStores to filter on in a search call and configurations + * for those dataStores. This is only considered for engines with multiple + * dataStores use case. For single dataStore within an engine, they should + * use the specs at the top level. * * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.SearchRequest.DataStoreSpec data_store_specs = 32; * @param array<\Google\Cloud\DiscoveryEngine\V1\SearchRequest\DataStoreSpec>|\Google\Protobuf\Internal\RepeatedField $var @@ -759,7 +769,8 @@ public function setCanonicalFilter($var) * The order in which documents are returned. Documents can be ordered by * a field in an [Document][google.cloud.discoveryengine.v1.Document] object. * Leave it unset if ordered by relevance. `order_by` expression is - * case-sensitive. For more information on ordering, see + * case-sensitive. + * For more information on ordering for retail search, see * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. * @@ -775,7 +786,8 @@ public function getOrderBy() * The order in which documents are returned. Documents can be ordered by * a field in an [Document][google.cloud.discoveryengine.v1.Document] object. * Leave it unset if ordered by relevance. `order_by` expression is - * case-sensitive. For more information on ordering, see + * case-sensitive. + * For more information on ordering for retail search, see * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. * @@ -866,7 +878,7 @@ public function setFacetSpecs($var) /** * Boost specification to boost certain documents. * For more information on boosting, see - * [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results) * * Generated from protobuf field .google.cloud.discoveryengine.v1.SearchRequest.BoostSpec boost_spec = 10; * @return \Google\Cloud\DiscoveryEngine\V1\SearchRequest\BoostSpec|null @@ -889,7 +901,7 @@ public function clearBoostSpec() /** * Boost specification to boost certain documents. * For more information on boosting, see - * [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results) * * Generated from protobuf field .google.cloud.discoveryengine.v1.SearchRequest.BoostSpec boost_spec = 10; * @param \Google\Cloud\DiscoveryEngine\V1\SearchRequest\BoostSpec $var @@ -908,15 +920,13 @@ public function setBoostSpec($var) * For public website search only, supported values are: * * `user_country_code`: string. Default empty. If set to non-empty, results * are restricted or boosted based on the location provided. - * Example: - * user_country_code: "au" + * For example, `user_country_code: "au"` * For available codes see [Country * Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) * * `search_type`: double. Default empty. Enables non-webpage searching * depending on the value. The only valid non-default value is 1, * which enables image searching. - * Example: - * search_type: 1 + * For example, `search_type: 1` * * Generated from protobuf field map params = 11; * @return \Google\Protobuf\Internal\MapField @@ -931,15 +941,13 @@ public function getParams() * For public website search only, supported values are: * * `user_country_code`: string. Default empty. If set to non-empty, results * are restricted or boosted based on the location provided. - * Example: - * user_country_code: "au" + * For example, `user_country_code: "au"` * For available codes see [Country * Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) * * `search_type`: double. Default empty. Enables non-webpage searching * depending on the value. The only valid non-default value is 1, * which enables image searching. - * Example: - * search_type: 1 + * For example, `search_type: 1` * * Generated from protobuf field map params = 11; * @param array|\Google\Protobuf\Internal\MapField $var diff --git a/DiscoveryEngine/src/V1/SearchRequest/DataStoreSpec.php b/DiscoveryEngine/src/V1/SearchRequest/DataStoreSpec.php index 3cc0381b4bf9..ff68448289ac 100644 --- a/DiscoveryEngine/src/V1/SearchRequest/DataStoreSpec.php +++ b/DiscoveryEngine/src/V1/SearchRequest/DataStoreSpec.php @@ -9,7 +9,9 @@ use Google\Protobuf\Internal\GPBUtil; /** - * A struct to define data stores to filter on in a search call. + * A struct to define data stores to filter on in a search call and + * configurations for those data stores. A maximum of 1 DataStoreSpec per + * data_store is allowed. Otherwise, an `INVALID_ARGUMENT` error is returned. * * Generated from protobuf message google.cloud.discoveryengine.v1.SearchRequest.DataStoreSpec */ diff --git a/DiscoveryEngine/src/V1/SearchRequest/FacetSpec.php b/DiscoveryEngine/src/V1/SearchRequest/FacetSpec.php index 6589ebb53cbf..8063f6467656 100644 --- a/DiscoveryEngine/src/V1/SearchRequest/FacetSpec.php +++ b/DiscoveryEngine/src/V1/SearchRequest/FacetSpec.php @@ -22,7 +22,7 @@ class FacetSpec extends \Google\Protobuf\Internal\Message */ protected $facet_key = null; /** - * Maximum of facet values that should be returned for this facet. If + * Maximum facet values that are returned for this facet. If * unspecified, defaults to 20. The maximum allowed value is 300. Values * above 300 are coerced to 300. * If this field is negative, an `INVALID_ARGUMENT` is returned. @@ -94,7 +94,7 @@ class FacetSpec extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\DiscoveryEngine\V1\SearchRequest\FacetSpec\FacetKey $facet_key * Required. The facet key specification. * @type int $limit - * Maximum of facet values that should be returned for this facet. If + * Maximum facet values that are returned for this facet. If * unspecified, defaults to 20. The maximum allowed value is 300. Values * above 300 are coerced to 300. * If this field is negative, an `INVALID_ARGUMENT` is returned. @@ -188,7 +188,7 @@ public function setFacetKey($var) } /** - * Maximum of facet values that should be returned for this facet. If + * Maximum facet values that are returned for this facet. If * unspecified, defaults to 20. The maximum allowed value is 300. Values * above 300 are coerced to 300. * If this field is negative, an `INVALID_ARGUMENT` is returned. @@ -202,7 +202,7 @@ public function getLimit() } /** - * Maximum of facet values that should be returned for this facet. If + * Maximum facet values that are returned for this facet. If * unspecified, defaults to 20. The maximum allowed value is 300. Values * above 300 are coerced to 300. * If this field is negative, an `INVALID_ARGUMENT` is returned. diff --git a/DiscoveryEngine/src/V1/SearchRequest/FacetSpec/FacetKey.php b/DiscoveryEngine/src/V1/SearchRequest/FacetSpec/FacetKey.php index 5dd094abf2a7..bcbe8c31acec 100644 --- a/DiscoveryEngine/src/V1/SearchRequest/FacetSpec/FacetKey.php +++ b/DiscoveryEngine/src/V1/SearchRequest/FacetSpec/FacetKey.php @@ -53,7 +53,7 @@ class FacetKey extends \Google\Protobuf\Internal\Message */ private $prefixes; /** - * Only get facet values that contains the given strings. For example, + * Only get facet values that contain the given strings. For example, * suppose "category" has three values "Action > 2022", * "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the * "category" facet only contains "Action > 2022" and "Sci-Fi > 2022". @@ -116,7 +116,7 @@ class FacetKey extends \Google\Protobuf\Internal\Message * "category" facet only contains "Action > 2022" and "Action > 2021". * Only supported on textual fields. Maximum is 10. * @type array|\Google\Protobuf\Internal\RepeatedField $contains - * Only get facet values that contains the given strings. For example, + * Only get facet values that contain the given strings. For example, * suppose "category" has three values "Action > 2022", * "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the * "category" facet only contains "Action > 2022" and "Sci-Fi > 2022". @@ -276,7 +276,7 @@ public function setPrefixes($var) } /** - * Only get facet values that contains the given strings. For example, + * Only get facet values that contain the given strings. For example, * suppose "category" has three values "Action > 2022", * "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the * "category" facet only contains "Action > 2022" and "Sci-Fi > 2022". @@ -291,7 +291,7 @@ public function getContains() } /** - * Only get facet values that contains the given strings. For example, + * Only get facet values that contain the given strings. For example, * suppose "category" has three values "Action > 2022", * "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the * "category" facet only contains "Action > 2022" and "Sci-Fi > 2022". diff --git a/DiscoveryEngine/src/V1/SearchRequest/SpellCorrectionSpec.php b/DiscoveryEngine/src/V1/SearchRequest/SpellCorrectionSpec.php index d845679e3907..622ad565c9dc 100644 --- a/DiscoveryEngine/src/V1/SearchRequest/SpellCorrectionSpec.php +++ b/DiscoveryEngine/src/V1/SearchRequest/SpellCorrectionSpec.php @@ -16,8 +16,8 @@ class SpellCorrectionSpec extends \Google\Protobuf\Internal\Message { /** - * The mode under which spell correction should take effect to - * replace the original search query. Default to + * The mode under which spell correction + * replaces the original search query. Defaults to * [Mode.AUTO][google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. * * Generated from protobuf field .google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec.Mode mode = 1; @@ -31,8 +31,8 @@ class SpellCorrectionSpec extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type int $mode - * The mode under which spell correction should take effect to - * replace the original search query. Default to + * The mode under which spell correction + * replaces the original search query. Defaults to * [Mode.AUTO][google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. * } */ @@ -42,8 +42,8 @@ public function __construct($data = NULL) { } /** - * The mode under which spell correction should take effect to - * replace the original search query. Default to + * The mode under which spell correction + * replaces the original search query. Defaults to * [Mode.AUTO][google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. * * Generated from protobuf field .google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec.Mode mode = 1; @@ -55,8 +55,8 @@ public function getMode() } /** - * The mode under which spell correction should take effect to - * replace the original search query. Default to + * The mode under which spell correction + * replaces the original search query. Defaults to * [Mode.AUTO][google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. * * Generated from protobuf field .google.cloud.discoveryengine.v1.SearchRequest.SpellCorrectionSpec.Mode mode = 1; diff --git a/DiscoveryEngine/src/V1/SearchRequest/SpellCorrectionSpec/Mode.php b/DiscoveryEngine/src/V1/SearchRequest/SpellCorrectionSpec/Mode.php index 4fee90010c4d..d3eb833b1536 100644 --- a/DiscoveryEngine/src/V1/SearchRequest/SpellCorrectionSpec/Mode.php +++ b/DiscoveryEngine/src/V1/SearchRequest/SpellCorrectionSpec/Mode.php @@ -22,10 +22,10 @@ class Mode */ const MODE_UNSPECIFIED = 0; /** - * Search API will try to find a spell suggestion if there - * is any and put in the + * Search API tries to find a spelling suggestion. If a suggestion is + * found, it is put in the * [SearchResponse.corrected_query][google.cloud.discoveryengine.v1.SearchResponse.corrected_query]. - * The spell suggestion will not be used as the search query. + * The spelling suggestion won't be used as the search query. * * Generated from protobuf enum SUGGESTION_ONLY = 1; */ diff --git a/DiscoveryEngine/src/V1/SearchResponse/Facet.php b/DiscoveryEngine/src/V1/SearchResponse/Facet.php index d57671e24b3d..3e84dbe49ee4 100644 --- a/DiscoveryEngine/src/V1/SearchResponse/Facet.php +++ b/DiscoveryEngine/src/V1/SearchResponse/Facet.php @@ -16,7 +16,7 @@ class Facet extends \Google\Protobuf\Internal\Message { /** - * The key for this facet. E.g., "colors" or "price". It matches + * The key for this facet. For example, `"colors"` or `"price"`. It matches * [SearchRequest.FacetSpec.FacetKey.key][google.cloud.discoveryengine.v1.SearchRequest.FacetSpec.FacetKey.key]. * * Generated from protobuf field string key = 1; @@ -42,7 +42,7 @@ class Facet extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $key - * The key for this facet. E.g., "colors" or "price". It matches + * The key for this facet. For example, `"colors"` or `"price"`. It matches * [SearchRequest.FacetSpec.FacetKey.key][google.cloud.discoveryengine.v1.SearchRequest.FacetSpec.FacetKey.key]. * @type array<\Google\Cloud\DiscoveryEngine\V1\SearchResponse\Facet\FacetValue>|\Google\Protobuf\Internal\RepeatedField $values * The facet values for this field. @@ -56,7 +56,7 @@ public function __construct($data = NULL) { } /** - * The key for this facet. E.g., "colors" or "price". It matches + * The key for this facet. For example, `"colors"` or `"price"`. It matches * [SearchRequest.FacetSpec.FacetKey.key][google.cloud.discoveryengine.v1.SearchRequest.FacetSpec.FacetKey.key]. * * Generated from protobuf field string key = 1; @@ -68,7 +68,7 @@ public function getKey() } /** - * The key for this facet. E.g., "colors" or "price". It matches + * The key for this facet. For example, `"colors"` or `"price"`. It matches * [SearchRequest.FacetSpec.FacetKey.key][google.cloud.discoveryengine.v1.SearchRequest.FacetSpec.FacetKey.key]. * * Generated from protobuf field string key = 1; diff --git a/DiscoveryEngine/src/V1/SearchResponse/SearchResult.php b/DiscoveryEngine/src/V1/SearchResponse/SearchResult.php index 13b3b7004bd2..6cdb6ffed0a5 100644 --- a/DiscoveryEngine/src/V1/SearchResponse/SearchResult.php +++ b/DiscoveryEngine/src/V1/SearchResponse/SearchResult.php @@ -24,7 +24,7 @@ class SearchResult extends \Google\Protobuf\Internal\Message protected $id = ''; /** * The document data snippet in the search response. Only fields that are - * marked as retrievable are populated. + * marked as `retrievable` are populated. * * Generated from protobuf field .google.cloud.discoveryengine.v1.Document document = 2; */ @@ -41,7 +41,7 @@ class SearchResult extends \Google\Protobuf\Internal\Message * searched [Document][google.cloud.discoveryengine.v1.Document]. * @type \Google\Cloud\DiscoveryEngine\V1\Document $document * The document data snippet in the search response. Only fields that are - * marked as retrievable are populated. + * marked as `retrievable` are populated. * } */ public function __construct($data = NULL) { @@ -79,7 +79,7 @@ public function setId($var) /** * The document data snippet in the search response. Only fields that are - * marked as retrievable are populated. + * marked as `retrievable` are populated. * * Generated from protobuf field .google.cloud.discoveryengine.v1.Document document = 2; * @return \Google\Cloud\DiscoveryEngine\V1\Document|null @@ -101,7 +101,7 @@ public function clearDocument() /** * The document data snippet in the search response. Only fields that are - * marked as retrievable are populated. + * marked as `retrievable` are populated. * * Generated from protobuf field .google.cloud.discoveryengine.v1.Document document = 2; * @param \Google\Cloud\DiscoveryEngine\V1\Document $var diff --git a/DiscoveryEngine/src/V1/SearchResponse/Summary.php b/DiscoveryEngine/src/V1/SearchResponse/Summary.php index 2f56583e2850..96f36103e851 100644 --- a/DiscoveryEngine/src/V1/SearchResponse/Summary.php +++ b/DiscoveryEngine/src/V1/SearchResponse/Summary.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Summary of the top N search result specified by the summary spec. + * Summary of the top N search results specified by the summary spec. * * Generated from protobuf message google.cloud.discoveryengine.v1.SearchResponse.Summary */ diff --git a/DiscoveryEngine/src/V1/SearchUseCase.php b/DiscoveryEngine/src/V1/SearchUseCase.php new file mode 100644 index 000000000000..0392f3a7d88a --- /dev/null +++ b/DiscoveryEngine/src/V1/SearchUseCase.php @@ -0,0 +1,65 @@ +google.cloud.discoveryengine.v1.SearchUseCase + */ +class SearchUseCase +{ + /** + * Value used when unset. Will not occur in CSS. + * + * Generated from protobuf enum SEARCH_USE_CASE_UNSPECIFIED = 0; + */ + const SEARCH_USE_CASE_UNSPECIFIED = 0; + /** + * Search use case. Expects the traffic has a non-empty + * [query][google.cloud.discoveryengine.v1.SearchRequest.query]. + * + * Generated from protobuf enum SEARCH_USE_CASE_SEARCH = 1; + */ + const SEARCH_USE_CASE_SEARCH = 1; + /** + * Browse use case. Expects the traffic has an empty + * [query][google.cloud.discoveryengine.v1.SearchRequest.query]. + * + * Generated from protobuf enum SEARCH_USE_CASE_BROWSE = 2; + */ + const SEARCH_USE_CASE_BROWSE = 2; + + private static $valueToName = [ + self::SEARCH_USE_CASE_UNSPECIFIED => 'SEARCH_USE_CASE_UNSPECIFIED', + self::SEARCH_USE_CASE_SEARCH => 'SEARCH_USE_CASE_SEARCH', + self::SEARCH_USE_CASE_BROWSE => 'SEARCH_USE_CASE_BROWSE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/DiscoveryEngine/src/V1/Session.php b/DiscoveryEngine/src/V1/Session.php new file mode 100644 index 000000000000..293964b9117a --- /dev/null +++ b/DiscoveryEngine/src/V1/Session.php @@ -0,0 +1,261 @@ +google.cloud.discoveryengine.v1.Session + */ +class Session extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. Fully qualified name + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * The state of the session. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session.State state = 2; + */ + protected $state = 0; + /** + * A unique identifier for tracking users. + * + * Generated from protobuf field string user_pseudo_id = 3; + */ + protected $user_pseudo_id = ''; + /** + * Turns. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Session.Turn turns = 4; + */ + private $turns; + /** + * Output only. The time the session started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $start_time = null; + /** + * Output only. The time the session finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Immutable. Fully qualified name + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*` + * @type int $state + * The state of the session. + * @type string $user_pseudo_id + * A unique identifier for tracking users. + * @type array<\Google\Cloud\DiscoveryEngine\V1\Session\Turn>|\Google\Protobuf\Internal\RepeatedField $turns + * Turns. + * @type \Google\Protobuf\Timestamp $start_time + * Output only. The time the session started. + * @type \Google\Protobuf\Timestamp $end_time + * Output only. The time the session finished. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Session::initOnce(); + parent::__construct($data); + } + + /** + * Immutable. Fully qualified name + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. Fully qualified name + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The state of the session. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session.State state = 2; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * The state of the session. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session.State state = 2; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DiscoveryEngine\V1\Session\State::class); + $this->state = $var; + + return $this; + } + + /** + * A unique identifier for tracking users. + * + * Generated from protobuf field string user_pseudo_id = 3; + * @return string + */ + public function getUserPseudoId() + { + return $this->user_pseudo_id; + } + + /** + * A unique identifier for tracking users. + * + * Generated from protobuf field string user_pseudo_id = 3; + * @param string $var + * @return $this + */ + public function setUserPseudoId($var) + { + GPBUtil::checkString($var, True); + $this->user_pseudo_id = $var; + + return $this; + } + + /** + * Turns. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Session.Turn turns = 4; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getTurns() + { + return $this->turns; + } + + /** + * Turns. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1.Session.Turn turns = 4; + * @param array<\Google\Cloud\DiscoveryEngine\V1\Session\Turn>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setTurns($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1\Session\Turn::class); + $this->turns = $arr; + + return $this; + } + + /** + * Output only. The time the session started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Output only. The time the session started. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 5 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * Output only. The time the session finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * Output only. The time the session finished. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 6 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/Session/State.php b/DiscoveryEngine/src/V1/Session/State.php new file mode 100644 index 000000000000..7990b51b3c52 --- /dev/null +++ b/DiscoveryEngine/src/V1/Session/State.php @@ -0,0 +1,55 @@ +google.cloud.discoveryengine.v1.Session.State + */ +class State +{ + /** + * State is unspecified. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The session is currently open. + * + * Generated from protobuf enum IN_PROGRESS = 1; + */ + const IN_PROGRESS = 1; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::IN_PROGRESS => 'IN_PROGRESS', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DiscoveryEngine/src/V1/Session/Turn.php b/DiscoveryEngine/src/V1/Session/Turn.php new file mode 100644 index 000000000000..c23d2946e607 --- /dev/null +++ b/DiscoveryEngine/src/V1/Session/Turn.php @@ -0,0 +1,121 @@ +google.cloud.discoveryengine.v1.Session.Turn + */ +class Turn extends \Google\Protobuf\Internal\Message +{ + /** + * The user query. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Query query = 1; + */ + protected $query = null; + /** + * The resource name of the answer to the user query. + * Only set if the answer generation (/answer API call) happened in this + * turn. + * + * Generated from protobuf field string answer = 2 [(.google.api.resource_reference) = { + */ + protected $answer = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\Query $query + * The user query. + * @type string $answer + * The resource name of the answer to the user query. + * Only set if the answer generation (/answer API call) happened in this + * turn. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\Session::initOnce(); + parent::__construct($data); + } + + /** + * The user query. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Query query = 1; + * @return \Google\Cloud\DiscoveryEngine\V1\Query|null + */ + public function getQuery() + { + return $this->query; + } + + public function hasQuery() + { + return isset($this->query); + } + + public function clearQuery() + { + unset($this->query); + } + + /** + * The user query. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Query query = 1; + * @param \Google\Cloud\DiscoveryEngine\V1\Query $var + * @return $this + */ + public function setQuery($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Query::class); + $this->query = $var; + + return $this; + } + + /** + * The resource name of the answer to the user query. + * Only set if the answer generation (/answer API call) happened in this + * turn. + * + * Generated from protobuf field string answer = 2 [(.google.api.resource_reference) = { + * @return string + */ + public function getAnswer() + { + return $this->answer; + } + + /** + * The resource name of the answer to the user query. + * Only set if the answer generation (/answer API call) happened in this + * turn. + * + * Generated from protobuf field string answer = 2 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setAnswer($var) + { + GPBUtil::checkString($var, True); + $this->answer = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1/TargetSite.php b/DiscoveryEngine/src/V1/TargetSite.php index f991ccb6758e..f6fcbb604bcf 100644 --- a/DiscoveryEngine/src/V1/TargetSite.php +++ b/DiscoveryEngine/src/V1/TargetSite.php @@ -54,6 +54,12 @@ class TargetSite extends \Google\Protobuf\Internal\Message * Generated from protobuf field string generated_uri_pattern = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ protected $generated_uri_pattern = ''; + /** + * Output only. Root domain of the provided_uri_pattern. + * + * Generated from protobuf field string root_domain_uri = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $root_domain_uri = ''; /** * Output only. Site ownership and validity verification status. * @@ -104,6 +110,8 @@ class TargetSite extends \Google\Protobuf\Internal\Message * generate the URI pattern to be used by the search engine. * @type string $generated_uri_pattern * Output only. This is system-generated based on the provided_uri_pattern. + * @type string $root_domain_uri + * Output only. Root domain of the provided_uri_pattern. * @type \Google\Cloud\DiscoveryEngine\V1\SiteVerificationInfo $site_verification_info * Output only. Site ownership and validity verification status. * @type int $indexing_status @@ -267,6 +275,32 @@ public function setGeneratedUriPattern($var) return $this; } + /** + * Output only. Root domain of the provided_uri_pattern. + * + * Generated from protobuf field string root_domain_uri = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRootDomainUri() + { + return $this->root_domain_uri; + } + + /** + * Output only. Root domain of the provided_uri_pattern. + * + * Generated from protobuf field string root_domain_uri = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRootDomainUri($var) + { + GPBUtil::checkString($var, True); + $this->root_domain_uri = $var; + + return $this; + } + /** * Output only. Site ownership and validity verification status. * diff --git a/DiscoveryEngine/src/V1/UpdateControlRequest.php b/DiscoveryEngine/src/V1/UpdateControlRequest.php new file mode 100644 index 000000000000..52b645c0a237 --- /dev/null +++ b/DiscoveryEngine/src/V1/UpdateControlRequest.php @@ -0,0 +1,163 @@ +google.cloud.discoveryengine.v1.UpdateControlRequest + */ +class UpdateControlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Control to update. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $control = null; + /** + * Optional. Indicates which fields in the provided + * [Control][google.cloud.discoveryengine.v1.Control] to update. The following + * are NOT supported: + * * [Control.name][google.cloud.discoveryengine.v1.Control.name] + * * [Control.solution_type][google.cloud.discoveryengine.v1.Control.solution_type] + * If not set or empty, all supported fields are updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\DiscoveryEngine\V1\Control $control Required. The Control to update. + * @param \Google\Protobuf\FieldMask $updateMask Optional. Indicates which fields in the provided + * [Control][google.cloud.discoveryengine.v1.Control] to update. The following + * are NOT supported: + * + * * [Control.name][google.cloud.discoveryengine.v1.Control.name] + * * [Control.solution_type][google.cloud.discoveryengine.v1.Control.solution_type] + * + * If not set or empty, all supported fields are updated. + * + * @return \Google\Cloud\DiscoveryEngine\V1\UpdateControlRequest + * + * @experimental + */ + public static function build(\Google\Cloud\DiscoveryEngine\V1\Control $control, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setControl($control) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\Control $control + * Required. The Control to update. + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Indicates which fields in the provided + * [Control][google.cloud.discoveryengine.v1.Control] to update. The following + * are NOT supported: + * * [Control.name][google.cloud.discoveryengine.v1.Control.name] + * * [Control.solution_type][google.cloud.discoveryengine.v1.Control.solution_type] + * If not set or empty, all supported fields are updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Control to update. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\DiscoveryEngine\V1\Control|null + */ + public function getControl() + { + return $this->control; + } + + public function hasControl() + { + return isset($this->control); + } + + public function clearControl() + { + unset($this->control); + } + + /** + * Required. The Control to update. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\DiscoveryEngine\V1\Control $var + * @return $this + */ + public function setControl($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Control::class); + $this->control = $var; + + return $this; + } + + /** + * Optional. Indicates which fields in the provided + * [Control][google.cloud.discoveryengine.v1.Control] to update. The following + * are NOT supported: + * * [Control.name][google.cloud.discoveryengine.v1.Control.name] + * * [Control.solution_type][google.cloud.discoveryengine.v1.Control.solution_type] + * If not set or empty, all supported fields are updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Indicates which fields in the provided + * [Control][google.cloud.discoveryengine.v1.Control] to update. The following + * are NOT supported: + * * [Control.name][google.cloud.discoveryengine.v1.Control.name] + * * [Control.solution_type][google.cloud.discoveryengine.v1.Control.solution_type] + * If not set or empty, all supported fields are updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/UpdateDocumentRequest.php b/DiscoveryEngine/src/V1/UpdateDocumentRequest.php index 055a7081b703..e7a11d150d48 100644 --- a/DiscoveryEngine/src/V1/UpdateDocumentRequest.php +++ b/DiscoveryEngine/src/V1/UpdateDocumentRequest.php @@ -31,16 +31,16 @@ class UpdateDocumentRequest extends \Google\Protobuf\Internal\Message */ protected $document = null; /** - * If set to true, and the + * If set to `true` and the * [Document][google.cloud.discoveryengine.v1.Document] is not found, a new - * [Document][google.cloud.discoveryengine.v1.Document] will be created. + * [Document][google.cloud.discoveryengine.v1.Document] is be created. * * Generated from protobuf field bool allow_missing = 2; */ protected $allow_missing = false; /** * Indicates which fields in the provided imported 'document' to update. If - * not set, will by default update all fields. + * not set, by default updates all fields. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; */ @@ -58,7 +58,7 @@ class UpdateDocumentRequest extends \Google\Protobuf\Internal\Message * [allow_missing][google.cloud.discoveryengine.v1.UpdateDocumentRequest.allow_missing] * is not set, a `NOT_FOUND` error is returned. * @param \Google\Protobuf\FieldMask $updateMask Indicates which fields in the provided imported 'document' to update. If - * not set, will by default update all fields. + * not set, by default updates all fields. * * @return \Google\Cloud\DiscoveryEngine\V1\UpdateDocumentRequest * @@ -87,12 +87,12 @@ public static function build(\Google\Cloud\DiscoveryEngine\V1\Document $document * [allow_missing][google.cloud.discoveryengine.v1.UpdateDocumentRequest.allow_missing] * is not set, a `NOT_FOUND` error is returned. * @type bool $allow_missing - * If set to true, and the + * If set to `true` and the * [Document][google.cloud.discoveryengine.v1.Document] is not found, a new - * [Document][google.cloud.discoveryengine.v1.Document] will be created. + * [Document][google.cloud.discoveryengine.v1.Document] is be created. * @type \Google\Protobuf\FieldMask $update_mask * Indicates which fields in the provided imported 'document' to update. If - * not set, will by default update all fields. + * not set, by default updates all fields. * } */ public function __construct($data = NULL) { @@ -151,9 +151,9 @@ public function setDocument($var) } /** - * If set to true, and the + * If set to `true` and the * [Document][google.cloud.discoveryengine.v1.Document] is not found, a new - * [Document][google.cloud.discoveryengine.v1.Document] will be created. + * [Document][google.cloud.discoveryengine.v1.Document] is be created. * * Generated from protobuf field bool allow_missing = 2; * @return bool @@ -164,9 +164,9 @@ public function getAllowMissing() } /** - * If set to true, and the + * If set to `true` and the * [Document][google.cloud.discoveryengine.v1.Document] is not found, a new - * [Document][google.cloud.discoveryengine.v1.Document] will be created. + * [Document][google.cloud.discoveryengine.v1.Document] is be created. * * Generated from protobuf field bool allow_missing = 2; * @param bool $var @@ -182,7 +182,7 @@ public function setAllowMissing($var) /** * Indicates which fields in the provided imported 'document' to update. If - * not set, will by default update all fields. + * not set, by default updates all fields. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; * @return \Google\Protobuf\FieldMask|null @@ -204,7 +204,7 @@ public function clearUpdateMask() /** * Indicates which fields in the provided imported 'document' to update. If - * not set, will by default update all fields. + * not set, by default updates all fields. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; * @param \Google\Protobuf\FieldMask $var diff --git a/DiscoveryEngine/src/V1/UpdateSchemaRequest.php b/DiscoveryEngine/src/V1/UpdateSchemaRequest.php index 1c39456ca86b..f6d44496c191 100644 --- a/DiscoveryEngine/src/V1/UpdateSchemaRequest.php +++ b/DiscoveryEngine/src/V1/UpdateSchemaRequest.php @@ -25,7 +25,7 @@ class UpdateSchemaRequest extends \Google\Protobuf\Internal\Message protected $schema = null; /** * If set to true, and the [Schema][google.cloud.discoveryengine.v1.Schema] is - * not found, a new [Schema][google.cloud.discoveryengine.v1.Schema] will be + * not found, a new [Schema][google.cloud.discoveryengine.v1.Schema] is * created. In this situation, `update_mask` is ignored. * * Generated from protobuf field bool allow_missing = 3; @@ -42,7 +42,7 @@ class UpdateSchemaRequest extends \Google\Protobuf\Internal\Message * Required. The [Schema][google.cloud.discoveryengine.v1.Schema] to update. * @type bool $allow_missing * If set to true, and the [Schema][google.cloud.discoveryengine.v1.Schema] is - * not found, a new [Schema][google.cloud.discoveryengine.v1.Schema] will be + * not found, a new [Schema][google.cloud.discoveryengine.v1.Schema] is * created. In this situation, `update_mask` is ignored. * } */ @@ -89,7 +89,7 @@ public function setSchema($var) /** * If set to true, and the [Schema][google.cloud.discoveryengine.v1.Schema] is - * not found, a new [Schema][google.cloud.discoveryengine.v1.Schema] will be + * not found, a new [Schema][google.cloud.discoveryengine.v1.Schema] is * created. In this situation, `update_mask` is ignored. * * Generated from protobuf field bool allow_missing = 3; @@ -102,7 +102,7 @@ public function getAllowMissing() /** * If set to true, and the [Schema][google.cloud.discoveryengine.v1.Schema] is - * not found, a new [Schema][google.cloud.discoveryengine.v1.Schema] will be + * not found, a new [Schema][google.cloud.discoveryengine.v1.Schema] is * created. In this situation, `update_mask` is ignored. * * Generated from protobuf field bool allow_missing = 3; diff --git a/DiscoveryEngine/src/V1/UpdateSessionRequest.php b/DiscoveryEngine/src/V1/UpdateSessionRequest.php new file mode 100644 index 000000000000..a5e5d5fc46aa --- /dev/null +++ b/DiscoveryEngine/src/V1/UpdateSessionRequest.php @@ -0,0 +1,158 @@ +google.cloud.discoveryengine.v1.UpdateSessionRequest + */ +class UpdateSessionRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Session to update. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session session = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $session = null; + /** + * Indicates which fields in the provided + * [Session][google.cloud.discoveryengine.v1.Session] to update. The following + * are NOT supported: + * * [Session.name][google.cloud.discoveryengine.v1.Session.name] + * If not set or empty, all supported fields are updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\DiscoveryEngine\V1\Session $session Required. The Session to update. + * @param \Google\Protobuf\FieldMask $updateMask Indicates which fields in the provided + * [Session][google.cloud.discoveryengine.v1.Session] to update. The following + * are NOT supported: + * + * * [Session.name][google.cloud.discoveryengine.v1.Session.name] + * + * If not set or empty, all supported fields are updated. + * + * @return \Google\Cloud\DiscoveryEngine\V1\UpdateSessionRequest + * + * @experimental + */ + public static function build(\Google\Cloud\DiscoveryEngine\V1\Session $session, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setSession($session) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1\Session $session + * Required. The Session to update. + * @type \Google\Protobuf\FieldMask $update_mask + * Indicates which fields in the provided + * [Session][google.cloud.discoveryengine.v1.Session] to update. The following + * are NOT supported: + * * [Session.name][google.cloud.discoveryengine.v1.Session.name] + * If not set or empty, all supported fields are updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1\ConversationalSearchService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Session to update. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session session = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\DiscoveryEngine\V1\Session|null + */ + public function getSession() + { + return $this->session; + } + + public function hasSession() + { + return isset($this->session); + } + + public function clearSession() + { + unset($this->session); + } + + /** + * Required. The Session to update. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1.Session session = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\DiscoveryEngine\V1\Session $var + * @return $this + */ + public function setSession($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1\Session::class); + $this->session = $var; + + return $this; + } + + /** + * Indicates which fields in the provided + * [Session][google.cloud.discoveryengine.v1.Session] to update. The following + * are NOT supported: + * * [Session.name][google.cloud.discoveryengine.v1.Session.name] + * If not set or empty, all supported fields are updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Indicates which fields in the provided + * [Session][google.cloud.discoveryengine.v1.Session] to update. The following + * are NOT supported: + * * [Session.name][google.cloud.discoveryengine.v1.Session.name] + * If not set or empty, all supported fields are updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1/UserEvent.php b/DiscoveryEngine/src/V1/UserEvent.php index c28628645192..e149133811d6 100644 --- a/DiscoveryEngine/src/V1/UserEvent.php +++ b/DiscoveryEngine/src/V1/UserEvent.php @@ -10,7 +10,7 @@ /** * UserEvent captures all metadata information Discovery Engine API needs to - * know about how end users interact with customers' website. + * know about how end users interact with your website. * * Generated from protobuf message google.cloud.discoveryengine.v1.UserEvent */ @@ -52,6 +52,31 @@ class UserEvent extends \Google\Protobuf\Internal\Message * Generated from protobuf field string user_pseudo_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ protected $user_pseudo_id = ''; + /** + * The [Engine][google.cloud.discoveryengine.v1.Engine] resource name, in the + * form of + * `projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`. + * Optional. Only required for + * [Engine][google.cloud.discoveryengine.v1.Engine] produced user events. For + * example, user events from blended search. + * + * Generated from protobuf field string engine = 19 [(.google.api.resource_reference) = { + */ + protected $engine = ''; + /** + * The [DataStore][google.cloud.discoveryengine.v1.DataStore] resource full + * name, of the form + * `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`. + * Optional. Only required for user events whose data store can't by + * determined by + * [UserEvent.engine][google.cloud.discoveryengine.v1.UserEvent.engine] or + * [UserEvent.documents][google.cloud.discoveryengine.v1.UserEvent.documents]. + * If data store is set in the parent of write/import/collect user event + * requests, this field can be omitted. + * + * Generated from protobuf field string data_store = 20 [(.google.api.resource_reference) = { + */ + protected $data_store = ''; /** * Only required for * [UserEventService.ImportUserEvents][google.cloud.discoveryengine.v1.UserEventService.ImportUserEvents] @@ -195,7 +220,7 @@ class UserEvent extends \Google\Protobuf\Internal\Message /** * A list of identifiers for the independent experiment groups this user event * belongs to. This is used to distinguish between user events associated with - * different experiment setups on the customer end. + * different experiment setups. * * Generated from protobuf field repeated string tag_ids = 15; */ @@ -275,6 +300,23 @@ class UserEvent extends \Google\Protobuf\Internal\Message * Analytics [Client * ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) * for this field. + * @type string $engine + * The [Engine][google.cloud.discoveryengine.v1.Engine] resource name, in the + * form of + * `projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`. + * Optional. Only required for + * [Engine][google.cloud.discoveryengine.v1.Engine] produced user events. For + * example, user events from blended search. + * @type string $data_store + * The [DataStore][google.cloud.discoveryengine.v1.DataStore] resource full + * name, of the form + * `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`. + * Optional. Only required for user events whose data store can't by + * determined by + * [UserEvent.engine][google.cloud.discoveryengine.v1.UserEvent.engine] or + * [UserEvent.documents][google.cloud.discoveryengine.v1.UserEvent.documents]. + * If data store is set in the parent of write/import/collect user event + * requests, this field can be omitted. * @type \Google\Protobuf\Timestamp $event_time * Only required for * [UserEventService.ImportUserEvents][google.cloud.discoveryengine.v1.UserEventService.ImportUserEvents] @@ -370,7 +412,7 @@ class UserEvent extends \Google\Protobuf\Internal\Message * @type array|\Google\Protobuf\Internal\RepeatedField $tag_ids * A list of identifiers for the independent experiment groups this user event * belongs to. This is used to distinguish between user events associated with - * different experiment setups on the customer end. + * different experiment setups. * @type array|\Google\Protobuf\Internal\RepeatedField $promotion_ids * The promotion IDs if this is an event associated with promotions. * Currently, this field is restricted to at most one ID. @@ -506,6 +548,84 @@ public function setUserPseudoId($var) return $this; } + /** + * The [Engine][google.cloud.discoveryengine.v1.Engine] resource name, in the + * form of + * `projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`. + * Optional. Only required for + * [Engine][google.cloud.discoveryengine.v1.Engine] produced user events. For + * example, user events from blended search. + * + * Generated from protobuf field string engine = 19 [(.google.api.resource_reference) = { + * @return string + */ + public function getEngine() + { + return $this->engine; + } + + /** + * The [Engine][google.cloud.discoveryengine.v1.Engine] resource name, in the + * form of + * `projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`. + * Optional. Only required for + * [Engine][google.cloud.discoveryengine.v1.Engine] produced user events. For + * example, user events from blended search. + * + * Generated from protobuf field string engine = 19 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setEngine($var) + { + GPBUtil::checkString($var, True); + $this->engine = $var; + + return $this; + } + + /** + * The [DataStore][google.cloud.discoveryengine.v1.DataStore] resource full + * name, of the form + * `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`. + * Optional. Only required for user events whose data store can't by + * determined by + * [UserEvent.engine][google.cloud.discoveryengine.v1.UserEvent.engine] or + * [UserEvent.documents][google.cloud.discoveryengine.v1.UserEvent.documents]. + * If data store is set in the parent of write/import/collect user event + * requests, this field can be omitted. + * + * Generated from protobuf field string data_store = 20 [(.google.api.resource_reference) = { + * @return string + */ + public function getDataStore() + { + return $this->data_store; + } + + /** + * The [DataStore][google.cloud.discoveryengine.v1.DataStore] resource full + * name, of the form + * `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`. + * Optional. Only required for user events whose data store can't by + * determined by + * [UserEvent.engine][google.cloud.discoveryengine.v1.UserEvent.engine] or + * [UserEvent.documents][google.cloud.discoveryengine.v1.UserEvent.documents]. + * If data store is set in the parent of write/import/collect user event + * requests, this field can be omitted. + * + * Generated from protobuf field string data_store = 20 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDataStore($var) + { + GPBUtil::checkString($var, True); + $this->data_store = $var; + + return $this; + } + /** * Only required for * [UserEventService.ImportUserEvents][google.cloud.discoveryengine.v1.UserEventService.ImportUserEvents] @@ -1027,7 +1147,7 @@ public function setTransactionInfo($var) /** * A list of identifiers for the independent experiment groups this user event * belongs to. This is used to distinguish between user events associated with - * different experiment setups on the customer end. + * different experiment setups. * * Generated from protobuf field repeated string tag_ids = 15; * @return \Google\Protobuf\Internal\RepeatedField @@ -1040,7 +1160,7 @@ public function getTagIds() /** * A list of identifiers for the independent experiment groups this user event * belongs to. This is used to distinguish between user events associated with - * different experiment setups on the customer end. + * different experiment setups. * * Generated from protobuf field repeated string tag_ids = 15; * @param array|\Google\Protobuf\Internal\RepeatedField $var diff --git a/DiscoveryEngine/src/V1/WriteUserEventRequest.php b/DiscoveryEngine/src/V1/WriteUserEventRequest.php index f83195066deb..c3694fc7145a 100644 --- a/DiscoveryEngine/src/V1/WriteUserEventRequest.php +++ b/DiscoveryEngine/src/V1/WriteUserEventRequest.php @@ -16,8 +16,16 @@ class WriteUserEventRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The parent DataStore resource name, such as + * Required. The parent resource name. + * If the write user event action is applied in + * [DataStore][google.cloud.discoveryengine.v1.DataStore] level, the format + * is: * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. + * If the write user event action is applied in [Location][] level, for + * example, the event with + * [Document][google.cloud.discoveryengine.v1.Document] across multiple + * [DataStore][google.cloud.discoveryengine.v1.DataStore], the format is: + * `projects/{project}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -28,6 +36,13 @@ class WriteUserEventRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field optional .google.cloud.discoveryengine.v1.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; */ protected $user_event = null; + /** + * If set to true, the user event is written asynchronously after + * validation, and the API responds without waiting for the write. + * + * Generated from protobuf field bool write_async = 3; + */ + protected $write_async = false; /** * Constructor. @@ -36,10 +51,21 @@ class WriteUserEventRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $parent - * Required. The parent DataStore resource name, such as + * Required. The parent resource name. + * If the write user event action is applied in + * [DataStore][google.cloud.discoveryengine.v1.DataStore] level, the format + * is: * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. + * If the write user event action is applied in [Location][] level, for + * example, the event with + * [Document][google.cloud.discoveryengine.v1.Document] across multiple + * [DataStore][google.cloud.discoveryengine.v1.DataStore], the format is: + * `projects/{project}/locations/{location}`. * @type \Google\Cloud\DiscoveryEngine\V1\UserEvent $user_event * Required. User event to write. + * @type bool $write_async + * If set to true, the user event is written asynchronously after + * validation, and the API responds without waiting for the write. * } */ public function __construct($data = NULL) { @@ -48,8 +74,16 @@ public function __construct($data = NULL) { } /** - * Required. The parent DataStore resource name, such as + * Required. The parent resource name. + * If the write user event action is applied in + * [DataStore][google.cloud.discoveryengine.v1.DataStore] level, the format + * is: * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. + * If the write user event action is applied in [Location][] level, for + * example, the event with + * [Document][google.cloud.discoveryengine.v1.Document] across multiple + * [DataStore][google.cloud.discoveryengine.v1.DataStore], the format is: + * `projects/{project}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -60,8 +94,16 @@ public function getParent() } /** - * Required. The parent DataStore resource name, such as + * Required. The parent resource name. + * If the write user event action is applied in + * [DataStore][google.cloud.discoveryengine.v1.DataStore] level, the format + * is: * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. + * If the write user event action is applied in [Location][] level, for + * example, the event with + * [Document][google.cloud.discoveryengine.v1.Document] across multiple + * [DataStore][google.cloud.discoveryengine.v1.DataStore], the format is: + * `projects/{project}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var @@ -111,5 +153,33 @@ public function setUserEvent($var) return $this; } + /** + * If set to true, the user event is written asynchronously after + * validation, and the API responds without waiting for the write. + * + * Generated from protobuf field bool write_async = 3; + * @return bool + */ + public function getWriteAsync() + { + return $this->write_async; + } + + /** + * If set to true, the user event is written asynchronously after + * validation, and the API responds without waiting for the write. + * + * Generated from protobuf field bool write_async = 3; + * @param bool $var + * @return $this + */ + public function setWriteAsync($var) + { + GPBUtil::checkBool($var); + $this->write_async = $var; + + return $this; + } + } diff --git a/DiscoveryEngine/src/V1/gapic_metadata.json b/DiscoveryEngine/src/V1/gapic_metadata.json index d41389e464c8..335b9e1831da 100644 --- a/DiscoveryEngine/src/V1/gapic_metadata.json +++ b/DiscoveryEngine/src/V1/gapic_metadata.json @@ -29,6 +29,40 @@ } } }, + "ControlService": { + "clients": { + "grpc": { + "libraryClient": "ControlServiceGapicClient", + "rpcs": { + "CreateControl": { + "methods": [ + "createControl" + ] + }, + "DeleteControl": { + "methods": [ + "deleteControl" + ] + }, + "GetControl": { + "methods": [ + "getControl" + ] + }, + "ListControls": { + "methods": [ + "listControls" + ] + }, + "UpdateControl": { + "methods": [ + "updateControl" + ] + } + } + } + } + }, "SearchService": { "clients": { "grpc": { @@ -48,6 +82,11 @@ "grpc": { "libraryClient": "ConversationalSearchServiceGapicClient", "rpcs": { + "AnswerQuery": { + "methods": [ + "answerQuery" + ] + }, "ConverseConversation": { "methods": [ "converseConversation" @@ -58,25 +97,55 @@ "createConversation" ] }, + "CreateSession": { + "methods": [ + "createSession" + ] + }, "DeleteConversation": { "methods": [ "deleteConversation" ] }, + "DeleteSession": { + "methods": [ + "deleteSession" + ] + }, + "GetAnswer": { + "methods": [ + "getAnswer" + ] + }, "GetConversation": { "methods": [ "getConversation" ] }, + "GetSession": { + "methods": [ + "getSession" + ] + }, "ListConversations": { "methods": [ "listConversations" ] }, + "ListSessions": { + "methods": [ + "listSessions" + ] + }, "UpdateConversation": { "methods": [ "updateConversation" ] + }, + "UpdateSession": { + "methods": [ + "updateSession" + ] } } } @@ -194,6 +263,48 @@ } } }, + "GroundedGenerationService": { + "clients": { + "grpc": { + "libraryClient": "GroundedGenerationServiceGapicClient", + "rpcs": { + "CheckGrounding": { + "methods": [ + "checkGrounding" + ] + } + } + } + } + }, + "ProjectService": { + "clients": { + "grpc": { + "libraryClient": "ProjectServiceGapicClient", + "rpcs": { + "ProvisionProject": { + "methods": [ + "provisionProject" + ] + } + } + } + } + }, + "RankService": { + "clients": { + "grpc": { + "libraryClient": "RankServiceGapicClient", + "rpcs": { + "Rank": { + "methods": [ + "rank" + ] + } + } + } + } + }, "RecommendationService": { "clients": { "grpc": { diff --git a/DiscoveryEngine/src/V1/resources/completion_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/completion_service_rest_client_config.php index 6b9858e46dc9..22950780b83b 100644 --- a/DiscoveryEngine/src/V1/resources/completion_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1/resources/completion_service_rest_client_config.php @@ -80,6 +80,30 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/operations/*}', diff --git a/DiscoveryEngine/src/V1/resources/control_service_client_config.json b/DiscoveryEngine/src/V1/resources/control_service_client_config.json new file mode 100644 index 000000000000..33605a623944 --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/control_service_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.discoveryengine.v1.ControlService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_2_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "CreateControl": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "DeleteControl": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "GetControl": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "ListControls": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "UpdateControl": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + } + } + } + } +} diff --git a/DiscoveryEngine/src/V1/resources/control_service_descriptor_config.php b/DiscoveryEngine/src/V1/resources/control_service_descriptor_config.php new file mode 100644 index 000000000000..700f71e26f1b --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/control_service_descriptor_config.php @@ -0,0 +1,107 @@ + [ + 'google.cloud.discoveryengine.v1.ControlService' => [ + 'CreateControl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\Control', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteControl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetControl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\Control', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListControls' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getControls', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\ListControlsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateControl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\Control', + 'headerParams' => [ + [ + 'keyName' => 'control.name', + 'fieldAccessors' => [ + 'getControl', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'control' => 'projects/{project}/locations/{location}/dataStores/{data_store}/controls/{control}', + 'dataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', + 'engine' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}', + 'projectLocationCollectionDataStore' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}', + 'projectLocationCollectionDataStoreControl' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/controls/{control}', + 'projectLocationCollectionEngineControl' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/controls/{control}', + 'projectLocationDataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', + 'projectLocationDataStoreControl' => 'projects/{project}/locations/{location}/dataStores/{data_store}/controls/{control}', + ], + ], + ], +]; diff --git a/DiscoveryEngine/src/V1/resources/control_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/control_service_rest_client_config.php new file mode 100644 index 000000000000..9e195e14c0a3 --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/control_service_rest_client_config.php @@ -0,0 +1,314 @@ + [ + 'google.cloud.discoveryengine.v1.ControlService' => [ + 'CreateControl' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/dataStores/*}/controls', + 'body' => 'control', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/controls', + 'body' => 'control', + 'queryParams' => [ + 'control_id', + ], + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/collections/*/engines/*}/controls', + 'body' => 'control', + 'queryParams' => [ + 'control_id', + ], + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'control_id', + ], + ], + 'DeleteControl' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/controls/*}', + 'additionalBindings' => [ + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/controls/*}', + ], + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*/controls/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetControl' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/controls/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/controls/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*/controls/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListControls' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/dataStores/*}/controls', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/controls', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/collections/*/engines/*}/controls', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateControl' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{control.name=projects/*/locations/*/dataStores/*/controls/*}', + 'body' => 'control', + 'additionalBindings' => [ + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{control.name=projects/*/locations/*/collections/*/dataStores/*/controls/*}', + 'body' => 'control', + ], + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{control.name=projects/*/locations/*/collections/*/engines/*/controls/*}', + 'body' => 'control', + ], + ], + 'placeholders' => [ + 'control.name' => [ + 'getters' => [ + 'getControl', + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/operations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataConnector}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/operations', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/DiscoveryEngine/src/V1/resources/conversational_search_service_client_config.json b/DiscoveryEngine/src/V1/resources/conversational_search_service_client_config.json index 4ec412b58543..adf744b2626c 100644 --- a/DiscoveryEngine/src/V1/resources/conversational_search_service_client_config.json +++ b/DiscoveryEngine/src/V1/resources/conversational_search_service_client_config.json @@ -28,6 +28,11 @@ } }, "methods": { + "AnswerQuery": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, "ConverseConversation": { "timeout_millis": 30000, "retry_codes_name": "retry_policy_2_codes", @@ -38,25 +43,55 @@ "retry_codes_name": "retry_policy_2_codes", "retry_params_name": "retry_policy_2_params" }, + "CreateSession": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, "DeleteConversation": { "timeout_millis": 30000, "retry_codes_name": "retry_policy_2_codes", "retry_params_name": "retry_policy_2_params" }, + "DeleteSession": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "GetAnswer": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, "GetConversation": { "timeout_millis": 30000, "retry_codes_name": "retry_policy_2_codes", "retry_params_name": "retry_policy_2_params" }, + "GetSession": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, "ListConversations": { "timeout_millis": 30000, "retry_codes_name": "retry_policy_2_codes", "retry_params_name": "retry_policy_2_params" }, + "ListSessions": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, "UpdateConversation": { "timeout_millis": 30000, "retry_codes_name": "retry_policy_2_codes", "retry_params_name": "retry_policy_2_params" + }, + "UpdateSession": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" } } } diff --git a/DiscoveryEngine/src/V1/resources/conversational_search_service_descriptor_config.php b/DiscoveryEngine/src/V1/resources/conversational_search_service_descriptor_config.php index fa82542ea810..09ebae4664d4 100644 --- a/DiscoveryEngine/src/V1/resources/conversational_search_service_descriptor_config.php +++ b/DiscoveryEngine/src/V1/resources/conversational_search_service_descriptor_config.php @@ -23,6 +23,18 @@ return [ 'interfaces' => [ 'google.cloud.discoveryengine.v1.ConversationalSearchService' => [ + 'AnswerQuery' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\AnswerQueryResponse', + 'headerParams' => [ + [ + 'keyName' => 'serving_config', + 'fieldAccessors' => [ + 'getServingConfig', + ], + ], + ], + ], 'ConverseConversation' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\ConverseConversationResponse', @@ -47,6 +59,18 @@ ], ], ], + 'CreateSession' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\Session', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], 'DeleteConversation' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Protobuf\GPBEmpty', @@ -59,6 +83,30 @@ ], ], ], + 'DeleteSession' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetAnswer' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\Answer', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], 'GetConversation' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\Conversation', @@ -71,6 +119,18 @@ ], ], ], + 'GetSession' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\Session', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], 'ListConversations' => [ 'pageStreaming' => [ 'requestPageTokenGetMethod' => 'getPageToken', @@ -91,6 +151,26 @@ ], ], ], + 'ListSessions' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getSessions', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\ListSessionsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], 'UpdateConversation' => [ 'callType' => \Google\ApiCore\Call::UNARY_CALL, 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\Conversation', @@ -104,21 +184,45 @@ ], ], ], + 'UpdateSession' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\Session', + 'headerParams' => [ + [ + 'keyName' => 'session.name', + 'fieldAccessors' => [ + 'getSession', + 'getName', + ], + ], + ], + ], 'templateMap' => [ + 'answer' => 'projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}/answers/{answer}', + 'chunk' => 'projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk}', 'conversation' => 'projects/{project}/locations/{location}/dataStores/{data_store}/conversations/{conversation}', 'dataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', 'document' => 'projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}', 'projectLocationCollectionDataStore' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}', 'projectLocationCollectionDataStoreBranchDocument' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}', + 'projectLocationCollectionDataStoreBranchDocumentChunk' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk}', 'projectLocationCollectionDataStoreConversation' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/conversations/{conversation}', 'projectLocationCollectionDataStoreServingConfig' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config}', + 'projectLocationCollectionDataStoreSession' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/sessions/{session}', + 'projectLocationCollectionDataStoreSessionAnswer' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/sessions/{session}/answers/{answer}', 'projectLocationCollectionEngineConversation' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/conversations/{conversation}', 'projectLocationCollectionEngineServingConfig' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config}', + 'projectLocationCollectionEngineSession' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}', + 'projectLocationCollectionEngineSessionAnswer' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/sessions/{session}/answers/{answer}', 'projectLocationDataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', 'projectLocationDataStoreBranchDocument' => 'projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}', + 'projectLocationDataStoreBranchDocumentChunk' => 'projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}/chunks/{chunk}', 'projectLocationDataStoreConversation' => 'projects/{project}/locations/{location}/dataStores/{data_store}/conversations/{conversation}', 'projectLocationDataStoreServingConfig' => 'projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}', + 'projectLocationDataStoreSession' => 'projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}', + 'projectLocationDataStoreSessionAnswer' => 'projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}/answers/{answer}', 'servingConfig' => 'projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}', + 'session' => 'projects/{project}/locations/{location}/dataStores/{data_store}/sessions/{session}', ], ], ], diff --git a/DiscoveryEngine/src/V1/resources/conversational_search_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/conversational_search_service_rest_client_config.php index 8c4fc636e456..d2bd41a33ce6 100644 --- a/DiscoveryEngine/src/V1/resources/conversational_search_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1/resources/conversational_search_service_rest_client_config.php @@ -23,6 +23,30 @@ return [ 'interfaces' => [ 'google.cloud.discoveryengine.v1.ConversationalSearchService' => [ + 'AnswerQuery' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{serving_config=projects/*/locations/*/dataStores/*/servingConfigs/*}:answer', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{serving_config=projects/*/locations/*/collections/*/dataStores/*/servingConfigs/*}:answer', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{serving_config=projects/*/locations/*/collections/*/engines/*/servingConfigs/*}:answer', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'serving_config' => [ + 'getters' => [ + 'getServingConfig', + ], + ], + ], + ], 'ConverseConversation' => [ 'method' => 'post', 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/conversations/*}:converse', @@ -71,6 +95,30 @@ ], ], ], + 'CreateSession' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/dataStores/*}/sessions', + 'body' => 'session', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/sessions', + 'body' => 'session', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/collections/*/engines/*}/sessions', + 'body' => 'session', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], 'DeleteConversation' => [ 'method' => 'delete', 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/conversations/*}', @@ -92,6 +140,48 @@ ], ], ], + 'DeleteSession' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/sessions/*}', + 'additionalBindings' => [ + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/sessions/*}', + ], + [ + 'method' => 'delete', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*/sessions/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetAnswer' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/sessions/*/answers/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/sessions/*/answers/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*/sessions/*/answers/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetConversation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/conversations/*}', @@ -113,6 +203,27 @@ ], ], ], + 'GetSession' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/sessions/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/sessions/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*/sessions/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'ListConversations' => [ 'method' => 'get', 'uriTemplate' => '/v1/{parent=projects/*/locations/*/dataStores/*}/conversations', @@ -134,6 +245,27 @@ ], ], ], + 'ListSessions' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/dataStores/*}/sessions', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/sessions', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*/collections/*/engines/*}/sessions', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], 'UpdateConversation' => [ 'method' => 'patch', 'uriTemplate' => '/v1/{conversation.name=projects/*/locations/*/dataStores/*/conversations/*}', @@ -159,8 +291,57 @@ ], ], ], + 'UpdateSession' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{session.name=projects/*/locations/*/dataStores/*/sessions/*}', + 'body' => 'session', + 'additionalBindings' => [ + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{session.name=projects/*/locations/*/collections/*/dataStores/*/sessions/*}', + 'body' => 'session', + ], + [ + 'method' => 'patch', + 'uriTemplate' => '/v1/{session.name=projects/*/locations/*/collections/*/engines/*/sessions/*}', + 'body' => 'session', + ], + ], + 'placeholders' => [ + 'session.name' => [ + 'getters' => [ + 'getSession', + 'getName', + ], + ], + ], + ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/operations/*}', diff --git a/DiscoveryEngine/src/V1/resources/data_store_service_descriptor_config.php b/DiscoveryEngine/src/V1/resources/data_store_service_descriptor_config.php index dff90f8a0b30..b065b9584949 100644 --- a/DiscoveryEngine/src/V1/resources/data_store_service_descriptor_config.php +++ b/DiscoveryEngine/src/V1/resources/data_store_service_descriptor_config.php @@ -109,9 +109,12 @@ 'templateMap' => [ 'collection' => 'projects/{project}/locations/{location}/collections/{collection}', 'dataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', + 'documentProcessingConfig' => 'projects/{project}/locations/{location}/dataStores/{data_store}/documentProcessingConfig', 'projectLocationCollectionDataStore' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}', + 'projectLocationCollectionDataStoreDocumentProcessingConfig' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/documentProcessingConfig', 'projectLocationCollectionDataStoreSchema' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/schemas/{schema}', 'projectLocationDataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', + 'projectLocationDataStoreDocumentProcessingConfig' => 'projects/{project}/locations/{location}/dataStores/{data_store}/documentProcessingConfig', 'projectLocationDataStoreSchema' => 'projects/{project}/locations/{location}/dataStores/{data_store}/schemas/{schema}', 'schema' => 'projects/{project}/locations/{location}/dataStores/{data_store}/schemas/{schema}', ], diff --git a/DiscoveryEngine/src/V1/resources/data_store_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/data_store_service_rest_client_config.php index 9776ad0cc278..965a30c026b3 100644 --- a/DiscoveryEngine/src/V1/resources/data_store_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1/resources/data_store_service_rest_client_config.php @@ -121,6 +121,30 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/operations/*}', diff --git a/DiscoveryEngine/src/V1/resources/document_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/document_service_rest_client_config.php index f7db09107acb..9b514246633a 100644 --- a/DiscoveryEngine/src/V1/resources/document_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1/resources/document_service_rest_client_config.php @@ -159,6 +159,30 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/operations/*}', diff --git a/DiscoveryEngine/src/V1/resources/engine_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/engine_service_rest_client_config.php index 16e20b986339..81022f6ae720 100644 --- a/DiscoveryEngine/src/V1/resources/engine_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1/resources/engine_service_rest_client_config.php @@ -86,6 +86,30 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/operations/*}', diff --git a/DiscoveryEngine/src/V1/resources/grounded_generation_service_client_config.json b/DiscoveryEngine/src/V1/resources/grounded_generation_service_client_config.json new file mode 100644 index 000000000000..7ee5457d398f --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/grounded_generation_service_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.discoveryengine.v1.GroundedGenerationService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_1_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_1_params": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 5000, + "initial_rpc_timeout_millis": 5000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 5000, + "total_timeout_millis": 5000 + } + }, + "methods": { + "CheckGrounding": { + "timeout_millis": 5000, + "retry_codes_name": "retry_policy_1_codes", + "retry_params_name": "retry_policy_1_params" + } + } + } + } +} diff --git a/DiscoveryEngine/src/V1/resources/grounded_generation_service_descriptor_config.php b/DiscoveryEngine/src/V1/resources/grounded_generation_service_descriptor_config.php new file mode 100644 index 000000000000..4049f6280469 --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/grounded_generation_service_descriptor_config.php @@ -0,0 +1,43 @@ + [ + 'google.cloud.discoveryengine.v1.GroundedGenerationService' => [ + 'CheckGrounding' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\CheckGroundingResponse', + 'headerParams' => [ + [ + 'keyName' => 'grounding_config', + 'fieldAccessors' => [ + 'getGroundingConfig', + ], + ], + ], + ], + 'templateMap' => [ + 'groundingConfig' => 'projects/{project}/locations/{location}/groundingConfigs/{grounding_config}', + ], + ], + ], +]; diff --git a/DiscoveryEngine/src/V1/resources/grounded_generation_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/grounded_generation_service_rest_client_config.php new file mode 100644 index 000000000000..fef1e9b8b780 --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/grounded_generation_service_rest_client_config.php @@ -0,0 +1,205 @@ + [ + 'google.cloud.discoveryengine.v1.GroundedGenerationService' => [ + 'CheckGrounding' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{grounding_config=projects/*/locations/*/groundingConfigs/*}:check', + 'body' => '*', + 'placeholders' => [ + 'grounding_config' => [ + 'getters' => [ + 'getGroundingConfig', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/operations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataConnector}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/operations', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/DiscoveryEngine/src/V1/resources/project_service_client_config.json b/DiscoveryEngine/src/V1/resources/project_service_client_config.json new file mode 100644 index 000000000000..f839e50fb937 --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/project_service_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.discoveryengine.v1.ProjectService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_2_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "ProvisionProject": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + } + } + } + } +} diff --git a/DiscoveryEngine/src/V1/resources/project_service_descriptor_config.php b/DiscoveryEngine/src/V1/resources/project_service_descriptor_config.php new file mode 100644 index 000000000000..c9c26b083790 --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/project_service_descriptor_config.php @@ -0,0 +1,50 @@ + [ + 'google.cloud.discoveryengine.v1.ProjectService' => [ + 'ProvisionProject' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\DiscoveryEngine\V1\Project', + 'metadataReturnType' => '\Google\Cloud\DiscoveryEngine\V1\ProvisionProjectMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'project' => 'projects/{project}', + ], + ], + ], +]; diff --git a/DiscoveryEngine/src/V1/resources/project_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/project_service_rest_client_config.php new file mode 100644 index 000000000000..64dd692a8a98 --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/project_service_rest_client_config.php @@ -0,0 +1,205 @@ + [ + 'google.cloud.discoveryengine.v1.ProjectService' => [ + 'ProvisionProject' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*}:provision', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/operations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataConnector}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/operations', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/DiscoveryEngine/src/V1/resources/rank_service_client_config.json b/DiscoveryEngine/src/V1/resources/rank_service_client_config.json new file mode 100644 index 000000000000..3f12f3704101 --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/rank_service_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.discoveryengine.v1.RankService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_2_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "Rank": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + } + } + } + } +} diff --git a/DiscoveryEngine/src/V1/resources/rank_service_descriptor_config.php b/DiscoveryEngine/src/V1/resources/rank_service_descriptor_config.php new file mode 100644 index 000000000000..8bd837aebc52 --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/rank_service_descriptor_config.php @@ -0,0 +1,43 @@ + [ + 'google.cloud.discoveryengine.v1.RankService' => [ + 'Rank' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1\RankResponse', + 'headerParams' => [ + [ + 'keyName' => 'ranking_config', + 'fieldAccessors' => [ + 'getRankingConfig', + ], + ], + ], + ], + 'templateMap' => [ + 'rankingConfig' => 'projects/{project}/locations/{location}/rankingConfigs/{ranking_config}', + ], + ], + ], +]; diff --git a/DiscoveryEngine/src/V1/resources/rank_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/rank_service_rest_client_config.php new file mode 100644 index 000000000000..f1fcc383aa1b --- /dev/null +++ b/DiscoveryEngine/src/V1/resources/rank_service_rest_client_config.php @@ -0,0 +1,205 @@ + [ + 'google.cloud.discoveryengine.v1.RankService' => [ + 'Rank' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{ranking_config=projects/*/locations/*/rankingConfigs/*}:rank', + 'body' => '*', + 'placeholders' => [ + 'ranking_config' => [ + 'getters' => [ + 'getRankingConfig', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/operations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataConnector}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/engines/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*/locations/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1/{name=projects/*}/operations', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/DiscoveryEngine/src/V1/resources/recommendation_service_descriptor_config.php b/DiscoveryEngine/src/V1/resources/recommendation_service_descriptor_config.php index 463f52dd0264..06583f9a1429 100644 --- a/DiscoveryEngine/src/V1/resources/recommendation_service_descriptor_config.php +++ b/DiscoveryEngine/src/V1/resources/recommendation_service_descriptor_config.php @@ -36,10 +36,14 @@ ], ], 'templateMap' => [ + 'dataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', 'document' => 'projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}', + 'engine' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}', + 'projectLocationCollectionDataStore' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}', 'projectLocationCollectionDataStoreBranchDocument' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}', 'projectLocationCollectionDataStoreServingConfig' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config}', 'projectLocationCollectionEngineServingConfig' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config}', + 'projectLocationDataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', 'projectLocationDataStoreBranchDocument' => 'projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}', 'projectLocationDataStoreServingConfig' => 'projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}', 'servingConfig' => 'projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}', diff --git a/DiscoveryEngine/src/V1/resources/recommendation_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/recommendation_service_rest_client_config.php index c0c54df4f420..78aace460236 100644 --- a/DiscoveryEngine/src/V1/resources/recommendation_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1/resources/recommendation_service_rest_client_config.php @@ -49,6 +49,30 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/operations/*}', diff --git a/DiscoveryEngine/src/V1/resources/schema_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/schema_service_rest_client_config.php index 2c993d0fdda4..5154565aade9 100644 --- a/DiscoveryEngine/src/V1/resources/schema_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1/resources/schema_service_rest_client_config.php @@ -121,6 +121,30 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/operations/*}', diff --git a/DiscoveryEngine/src/V1/resources/search_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/search_service_rest_client_config.php index a7c365492eff..11cee7d770af 100644 --- a/DiscoveryEngine/src/V1/resources/search_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1/resources/search_service_rest_client_config.php @@ -49,6 +49,30 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/operations/*}', diff --git a/DiscoveryEngine/src/V1/resources/site_search_engine_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/site_search_engine_service_rest_client_config.php index ffb91db39940..93525742defa 100644 --- a/DiscoveryEngine/src/V1/resources/site_search_engine_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1/resources/site_search_engine_service_rest_client_config.php @@ -231,6 +231,30 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/operations/*}', diff --git a/DiscoveryEngine/src/V1/resources/user_event_service_descriptor_config.php b/DiscoveryEngine/src/V1/resources/user_event_service_descriptor_config.php index 8fbb8bc7adbc..1610d39d63da 100644 --- a/DiscoveryEngine/src/V1/resources/user_event_service_descriptor_config.php +++ b/DiscoveryEngine/src/V1/resources/user_event_service_descriptor_config.php @@ -69,6 +69,7 @@ 'templateMap' => [ 'dataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', 'document' => 'projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}', + 'engine' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}', 'projectLocationCollectionDataStore' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}', 'projectLocationCollectionDataStoreBranchDocument' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}', 'projectLocationDataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', diff --git a/DiscoveryEngine/src/V1/resources/user_event_service_rest_client_config.php b/DiscoveryEngine/src/V1/resources/user_event_service_rest_client_config.php index 5f219ac9cece..f9cfde4c9245 100644 --- a/DiscoveryEngine/src/V1/resources/user_event_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1/resources/user_event_service_rest_client_config.php @@ -69,6 +69,11 @@ 'uriTemplate' => '/v1/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:write', 'body' => 'user_event', ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{parent=projects/*/locations/*}/userEvents:write', + 'body' => 'user_event', + ], ], 'placeholders' => [ 'parent' => [ @@ -80,6 +85,30 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1/{name=projects/*/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/Answer.php b/DiscoveryEngine/src/V1beta/Answer.php index 23bdd8e6585f..72054a5d1a67 100644 --- a/DiscoveryEngine/src/V1beta/Answer.php +++ b/DiscoveryEngine/src/V1beta/Answer.php @@ -17,7 +17,7 @@ class Answer extends \Google\Protobuf\Internal\Message { /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ @@ -92,7 +92,7 @@ class Answer extends \Google\Protobuf\Internal\Message * * @type string $name * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` * @type int $state * The state of the answer generation. * @type string $answer_text @@ -123,7 +123,7 @@ public function __construct($data = NULL) { /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * @return string @@ -135,7 +135,7 @@ public function getName() /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*/answers/*` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * @param string $var diff --git a/DiscoveryEngine/src/V1beta/Answer/Reference/ChunkInfo/DocumentMetadata.php b/DiscoveryEngine/src/V1beta/Answer/Reference/ChunkInfo/DocumentMetadata.php index 006d9fbc795d..56a3a562a7bb 100644 --- a/DiscoveryEngine/src/V1beta/Answer/Reference/ChunkInfo/DocumentMetadata.php +++ b/DiscoveryEngine/src/V1beta/Answer/Reference/ChunkInfo/DocumentMetadata.php @@ -39,6 +39,13 @@ class DocumentMetadata extends \Google\Protobuf\Internal\Message * Generated from protobuf field string page_identifier = 4; */ protected $page_identifier = ''; + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + */ + protected $struct_data = null; /** * Constructor. @@ -54,6 +61,9 @@ class DocumentMetadata extends \Google\Protobuf\Internal\Message * Title. * @type string $page_identifier * Page identifier. + * @type \Google\Protobuf\Struct $struct_data + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. * } */ public function __construct($data = NULL) { @@ -165,6 +175,44 @@ public function setPageIdentifier($var) return $this; } + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + * @return \Google\Protobuf\Struct|null + */ + public function getStructData() + { + return $this->struct_data; + } + + public function hasStructData() + { + return isset($this->struct_data); + } + + public function clearStructData() + { + unset($this->struct_data); + } + + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setStructData($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->struct_data = $var; + + return $this; + } + } diff --git a/DiscoveryEngine/src/V1beta/Answer/Reference/UnstructuredDocumentInfo.php b/DiscoveryEngine/src/V1beta/Answer/Reference/UnstructuredDocumentInfo.php index 649c7fb6cc3d..93469abf6b26 100644 --- a/DiscoveryEngine/src/V1beta/Answer/Reference/UnstructuredDocumentInfo.php +++ b/DiscoveryEngine/src/V1beta/Answer/Reference/UnstructuredDocumentInfo.php @@ -39,6 +39,13 @@ class UnstructuredDocumentInfo extends \Google\Protobuf\Internal\Message * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Answer.Reference.UnstructuredDocumentInfo.ChunkContent chunk_contents = 4; */ private $chunk_contents; + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + */ + protected $struct_data = null; /** * Constructor. @@ -54,6 +61,9 @@ class UnstructuredDocumentInfo extends \Google\Protobuf\Internal\Message * Title. * @type array<\Google\Cloud\DiscoveryEngine\V1beta\Answer\Reference\UnstructuredDocumentInfo\ChunkContent>|\Google\Protobuf\Internal\RepeatedField $chunk_contents * List of cited chunk contents derived from document content. + * @type \Google\Protobuf\Struct $struct_data + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. * } */ public function __construct($data = NULL) { @@ -165,6 +175,44 @@ public function setChunkContents($var) return $this; } + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + * @return \Google\Protobuf\Struct|null + */ + public function getStructData() + { + return $this->struct_data; + } + + public function hasStructData() + { + return isset($this->struct_data); + } + + public function clearStructData() + { + unset($this->struct_data); + } + + /** + * The structured JSON metadata for the document. + * It is populated from the struct data from the Chunk in search result. + * + * Generated from protobuf field .google.protobuf.Struct struct_data = 5; + * @param \Google\Protobuf\Struct $var + * @return $this + */ + public function setStructData($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Struct::class); + $this->struct_data = $var; + + return $this; + } + } diff --git a/DiscoveryEngine/src/V1beta/AnswerQueryRequest.php b/DiscoveryEngine/src/V1beta/AnswerQueryRequest.php index fe1906cf535e..0aa0b6246e84 100644 --- a/DiscoveryEngine/src/V1beta/AnswerQueryRequest.php +++ b/DiscoveryEngine/src/V1beta/AnswerQueryRequest.php @@ -37,8 +37,8 @@ class AnswerQueryRequest extends \Google\Protobuf\Internal\Message /** * The session resource name. Not required. * When session field is not set, the API is in sessionless mode. - * We support auto session mode: users can use the wildcard symbol “-” as - * session id. A new id will be automatically generated and assigned. + * We support auto session mode: users can use the wildcard symbol `-` as + * session ID. A new ID will be automatically generated and assigned. * * Generated from protobuf field string session = 3 [(.google.api.resource_reference) = { */ @@ -117,8 +117,8 @@ class AnswerQueryRequest extends \Google\Protobuf\Internal\Message * @type string $session * The session resource name. Not required. * When session field is not set, the API is in sessionless mode. - * We support auto session mode: users can use the wildcard symbol “-” as - * session id. A new id will be automatically generated and assigned. + * We support auto session mode: users can use the wildcard symbol `-` as + * session ID. A new ID will be automatically generated and assigned. * @type \Google\Cloud\DiscoveryEngine\V1beta\AnswerQueryRequest\SafetySpec $safety_spec * Model specification. * @type \Google\Cloud\DiscoveryEngine\V1beta\AnswerQueryRequest\RelatedQuestionsSpec $related_questions_spec @@ -228,8 +228,8 @@ public function setQuery($var) /** * The session resource name. Not required. * When session field is not set, the API is in sessionless mode. - * We support auto session mode: users can use the wildcard symbol “-” as - * session id. A new id will be automatically generated and assigned. + * We support auto session mode: users can use the wildcard symbol `-` as + * session ID. A new ID will be automatically generated and assigned. * * Generated from protobuf field string session = 3 [(.google.api.resource_reference) = { * @return string @@ -242,8 +242,8 @@ public function getSession() /** * The session resource name. Not required. * When session field is not set, the API is in sessionless mode. - * We support auto session mode: users can use the wildcard symbol “-” as - * session id. A new id will be automatically generated and assigned. + * We support auto session mode: users can use the wildcard symbol `-` as + * session ID. A new ID will be automatically generated and assigned. * * Generated from protobuf field string session = 3 [(.google.api.resource_reference) = { * @param string $var diff --git a/DiscoveryEngine/src/V1beta/AnswerQueryRequest/AnswerGenerationSpec.php b/DiscoveryEngine/src/V1beta/AnswerQueryRequest/AnswerGenerationSpec.php index 1a18bc0799e5..29fcb539875e 100644 --- a/DiscoveryEngine/src/V1beta/AnswerQueryRequest/AnswerGenerationSpec.php +++ b/DiscoveryEngine/src/V1beta/AnswerQueryRequest/AnswerGenerationSpec.php @@ -68,6 +68,15 @@ class AnswerGenerationSpec extends \Google\Protobuf\Internal\Message * Generated from protobuf field bool ignore_non_answer_seeking_query = 6; */ protected $ignore_non_answer_seeking_query = false; + /** + * Specifies whether to filter out queries that have low relevance. + * If this field is set to `false`, all search results are used regardless + * of relevance to generate answers. If set to `true` or unset, the behavior + * will be determined automatically by the service. + * + * Generated from protobuf field optional bool ignore_low_relevant_content = 7; + */ + protected $ignore_low_relevant_content = null; /** * Constructor. @@ -104,6 +113,11 @@ class AnswerGenerationSpec extends \Google\Protobuf\Internal\Message * non-answer seeking query. If this field is set to `true`, we skip * generating answers for non-answer seeking queries and return * fallback messages instead. + * @type bool $ignore_low_relevant_content + * Specifies whether to filter out queries that have low relevance. + * If this field is set to `false`, all search results are used regardless + * of relevance to generate answers. If set to `true` or unset, the behavior + * will be determined automatically by the service. * } */ public function __construct($data = NULL) { @@ -321,6 +335,48 @@ public function setIgnoreNonAnswerSeekingQuery($var) return $this; } + /** + * Specifies whether to filter out queries that have low relevance. + * If this field is set to `false`, all search results are used regardless + * of relevance to generate answers. If set to `true` or unset, the behavior + * will be determined automatically by the service. + * + * Generated from protobuf field optional bool ignore_low_relevant_content = 7; + * @return bool + */ + public function getIgnoreLowRelevantContent() + { + return isset($this->ignore_low_relevant_content) ? $this->ignore_low_relevant_content : false; + } + + public function hasIgnoreLowRelevantContent() + { + return isset($this->ignore_low_relevant_content); + } + + public function clearIgnoreLowRelevantContent() + { + unset($this->ignore_low_relevant_content); + } + + /** + * Specifies whether to filter out queries that have low relevance. + * If this field is set to `false`, all search results are used regardless + * of relevance to generate answers. If set to `true` or unset, the behavior + * will be determined automatically by the service. + * + * Generated from protobuf field optional bool ignore_low_relevant_content = 7; + * @param bool $var + * @return $this + */ + public function setIgnoreLowRelevantContent($var) + { + GPBUtil::checkBool($var); + $this->ignore_low_relevant_content = $var; + + return $this; + } + } diff --git a/DiscoveryEngine/src/V1beta/AnswerQueryRequest/QueryUnderstandingSpec/QueryRephraserSpec.php b/DiscoveryEngine/src/V1beta/AnswerQueryRequest/QueryUnderstandingSpec/QueryRephraserSpec.php index 1913fdd4765e..c64a0cc76309 100644 --- a/DiscoveryEngine/src/V1beta/AnswerQueryRequest/QueryUnderstandingSpec/QueryRephraserSpec.php +++ b/DiscoveryEngine/src/V1beta/AnswerQueryRequest/QueryUnderstandingSpec/QueryRephraserSpec.php @@ -23,7 +23,7 @@ class QueryRephraserSpec extends \Google\Protobuf\Internal\Message protected $disable = false; /** * Max rephrase steps. - * The max number is 10 steps. + * The max number is 5 steps. * If not set or set to < 1, it will be set to 1 by default. * * Generated from protobuf field int32 max_rephrase_steps = 2; @@ -40,7 +40,7 @@ class QueryRephraserSpec extends \Google\Protobuf\Internal\Message * Disable query rephraser. * @type int $max_rephrase_steps * Max rephrase steps. - * The max number is 10 steps. + * The max number is 5 steps. * If not set or set to < 1, it will be set to 1 by default. * } */ @@ -77,7 +77,7 @@ public function setDisable($var) /** * Max rephrase steps. - * The max number is 10 steps. + * The max number is 5 steps. * If not set or set to < 1, it will be set to 1 by default. * * Generated from protobuf field int32 max_rephrase_steps = 2; @@ -90,7 +90,7 @@ public function getMaxRephraseSteps() /** * Max rephrase steps. - * The max number is 10 steps. + * The max number is 5 steps. * If not set or set to < 1, it will be set to 1 by default. * * Generated from protobuf field int32 max_rephrase_steps = 2; diff --git a/DiscoveryEngine/src/V1beta/AnswerQueryRequest/SearchSpec/SearchParams.php b/DiscoveryEngine/src/V1beta/AnswerQueryRequest/SearchSpec/SearchParams.php index b77dfa282013..03c49f67a266 100644 --- a/DiscoveryEngine/src/V1beta/AnswerQueryRequest/SearchSpec/SearchParams.php +++ b/DiscoveryEngine/src/V1beta/AnswerQueryRequest/SearchSpec/SearchParams.php @@ -61,6 +61,15 @@ class SearchParams extends \Google\Protobuf\Internal\Message * Generated from protobuf field string order_by = 4; */ protected $order_by = ''; + /** + * Specs defining dataStores to filter on in a search call and + * configurations for those dataStores. This is only considered for + * engines with multiple dataStores use case. For single dataStore within + * an engine, they should use the specs at the top level. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchRequest.DataStoreSpec data_store_specs = 7; + */ + private $data_store_specs; /** * Constructor. @@ -98,6 +107,11 @@ class SearchParams extends \Google\Protobuf\Internal\Message * case-sensitive. For more information on ordering, see * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. + * @type array<\Google\Cloud\DiscoveryEngine\V1beta\SearchRequest\DataStoreSpec>|\Google\Protobuf\Internal\RepeatedField $data_store_specs + * Specs defining dataStores to filter on in a search call and + * configurations for those dataStores. This is only considered for + * engines with multiple dataStores use case. For single dataStore within + * an engine, they should use the specs at the top level. * } */ public function __construct($data = NULL) { @@ -263,6 +277,38 @@ public function setOrderBy($var) return $this; } + /** + * Specs defining dataStores to filter on in a search call and + * configurations for those dataStores. This is only considered for + * engines with multiple dataStores use case. For single dataStore within + * an engine, they should use the specs at the top level. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchRequest.DataStoreSpec data_store_specs = 7; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getDataStoreSpecs() + { + return $this->data_store_specs; + } + + /** + * Specs defining dataStores to filter on in a search call and + * configurations for those dataStores. This is only considered for + * engines with multiple dataStores use case. For single dataStore within + * an engine, they should use the specs at the top level. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchRequest.DataStoreSpec data_store_specs = 7; + * @param array<\Google\Cloud\DiscoveryEngine\V1beta\SearchRequest\DataStoreSpec>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setDataStoreSpecs($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1beta\SearchRequest\DataStoreSpec::class); + $this->data_store_specs = $arr; + + return $this; + } + } diff --git a/DiscoveryEngine/src/V1beta/AnswerQueryResponse.php b/DiscoveryEngine/src/V1beta/AnswerQueryResponse.php index 5cf9da1982b3..3d61a995d7b2 100644 --- a/DiscoveryEngine/src/V1beta/AnswerQueryResponse.php +++ b/DiscoveryEngine/src/V1beta/AnswerQueryResponse.php @@ -37,6 +37,12 @@ class AnswerQueryResponse extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Session session = 2; */ protected $session = null; + /** + * A global unique ID used for logging. + * + * Generated from protobuf field string answer_query_token = 3; + */ + protected $answer_query_token = ''; /** * Constructor. @@ -56,6 +62,8 @@ class AnswerQueryResponse extends \Google\Protobuf\Internal\Message * It will be only available when session field is set and valid in the * [AnswerQueryRequest][google.cloud.discoveryengine.v1beta.AnswerQueryRequest] * request. + * @type string $answer_query_token + * A global unique ID used for logging. * } */ public function __construct($data = NULL) { @@ -151,5 +159,31 @@ public function setSession($var) return $this; } + /** + * A global unique ID used for logging. + * + * Generated from protobuf field string answer_query_token = 3; + * @return string + */ + public function getAnswerQueryToken() + { + return $this->answer_query_token; + } + + /** + * A global unique ID used for logging. + * + * Generated from protobuf field string answer_query_token = 3; + * @param string $var + * @return $this + */ + public function setAnswerQueryToken($var) + { + GPBUtil::checkString($var, True); + $this->answer_query_token = $var; + + return $this; + } + } diff --git a/DiscoveryEngine/src/V1beta/CheckGroundingRequest.php b/DiscoveryEngine/src/V1beta/CheckGroundingRequest.php index 0356839a0351..9e7866de7a60 100644 --- a/DiscoveryEngine/src/V1beta/CheckGroundingRequest.php +++ b/DiscoveryEngine/src/V1beta/CheckGroundingRequest.php @@ -25,7 +25,7 @@ class CheckGroundingRequest extends \Google\Protobuf\Internal\Message */ protected $grounding_config = ''; /** - * Answer candidate to check. + * Answer candidate to check. Can have a maximum length of 1024 characters. * * Generated from protobuf field string answer_candidate = 2; */ @@ -43,6 +43,26 @@ class CheckGroundingRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.discoveryengine.v1beta.CheckGroundingSpec grounding_spec = 4; */ protected $grounding_spec = null; + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 5; + */ + private $user_labels; /** * Constructor. @@ -54,12 +74,28 @@ class CheckGroundingRequest extends \Google\Protobuf\Internal\Message * Required. The resource name of the grounding config, such as * `projects/*/locations/global/groundingConfigs/default_grounding_config`. * @type string $answer_candidate - * Answer candidate to check. + * Answer candidate to check. Can have a maximum length of 1024 characters. * @type array<\Google\Cloud\DiscoveryEngine\V1beta\GroundingFact>|\Google\Protobuf\Internal\RepeatedField $facts * List of facts for the grounding check. * We support up to 200 facts. * @type \Google\Cloud\DiscoveryEngine\V1beta\CheckGroundingSpec $grounding_spec * Configuration of the grounding check. + * @type array|\Google\Protobuf\Internal\MapField $user_labels + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. * } */ public function __construct($data = NULL) { @@ -96,7 +132,7 @@ public function setGroundingConfig($var) } /** - * Answer candidate to check. + * Answer candidate to check. Can have a maximum length of 1024 characters. * * Generated from protobuf field string answer_candidate = 2; * @return string @@ -107,7 +143,7 @@ public function getAnswerCandidate() } /** - * Answer candidate to check. + * Answer candidate to check. Can have a maximum length of 1024 characters. * * Generated from protobuf field string answer_candidate = 2; * @param string $var @@ -185,5 +221,59 @@ public function setGroundingSpec($var) return $this; } + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 5; + * @return \Google\Protobuf\Internal\MapField + */ + public function getUserLabels() + { + return $this->user_labels; + } + + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 5; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setUserLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->user_labels = $arr; + + return $this; + } + } diff --git a/DiscoveryEngine/src/V1beta/CheckGroundingResponse/Claim.php b/DiscoveryEngine/src/V1beta/CheckGroundingResponse/Claim.php index 1fdd0edfc232..222acc3d71a3 100644 --- a/DiscoveryEngine/src/V1beta/CheckGroundingResponse/Claim.php +++ b/DiscoveryEngine/src/V1beta/CheckGroundingResponse/Claim.php @@ -46,6 +46,19 @@ class Claim extends \Google\Protobuf\Internal\Message * Generated from protobuf field repeated int32 citation_indices = 4; */ private $citation_indices; + /** + * Indicates that this claim required grounding check. When the system + * decided this claim doesn't require attribution/grounding check, this + * field will be set to false. In that case, no grounding check was done for + * the claim and therefore + * [citation_indices][google.cloud.discoveryengine.v1beta.CheckGroundingResponse.Claim.citation_indices], + * and + * [anti_citation_indices][google.cloud.discoveryengine.v1beta.CheckGroundingResponse.Claim.anti_citation_indices] + * should not be returned. + * + * Generated from protobuf field optional bool grounding_check_required = 6; + */ + protected $grounding_check_required = null; /** * Constructor. @@ -68,6 +81,15 @@ class Claim extends \Google\Protobuf\Internal\Message * cited_chunks[1], cited_chunks[3], cited_chunks[4] are the facts cited * supporting for the claim. A citation to a fact indicates that the claim * is supported by the fact. + * @type bool $grounding_check_required + * Indicates that this claim required grounding check. When the system + * decided this claim doesn't require attribution/grounding check, this + * field will be set to false. In that case, no grounding check was done for + * the claim and therefore + * [citation_indices][google.cloud.discoveryengine.v1beta.CheckGroundingResponse.Claim.citation_indices], + * and + * [anti_citation_indices][google.cloud.discoveryengine.v1beta.CheckGroundingResponse.Claim.anti_citation_indices] + * should not be returned. * } */ public function __construct($data = NULL) { @@ -213,6 +235,56 @@ public function setCitationIndices($var) return $this; } + /** + * Indicates that this claim required grounding check. When the system + * decided this claim doesn't require attribution/grounding check, this + * field will be set to false. In that case, no grounding check was done for + * the claim and therefore + * [citation_indices][google.cloud.discoveryengine.v1beta.CheckGroundingResponse.Claim.citation_indices], + * and + * [anti_citation_indices][google.cloud.discoveryengine.v1beta.CheckGroundingResponse.Claim.anti_citation_indices] + * should not be returned. + * + * Generated from protobuf field optional bool grounding_check_required = 6; + * @return bool + */ + public function getGroundingCheckRequired() + { + return isset($this->grounding_check_required) ? $this->grounding_check_required : false; + } + + public function hasGroundingCheckRequired() + { + return isset($this->grounding_check_required); + } + + public function clearGroundingCheckRequired() + { + unset($this->grounding_check_required); + } + + /** + * Indicates that this claim required grounding check. When the system + * decided this claim doesn't require attribution/grounding check, this + * field will be set to false. In that case, no grounding check was done for + * the claim and therefore + * [citation_indices][google.cloud.discoveryengine.v1beta.CheckGroundingResponse.Claim.citation_indices], + * and + * [anti_citation_indices][google.cloud.discoveryengine.v1beta.CheckGroundingResponse.Claim.anti_citation_indices] + * should not be returned. + * + * Generated from protobuf field optional bool grounding_check_required = 6; + * @param bool $var + * @return $this + */ + public function setGroundingCheckRequired($var) + { + GPBUtil::checkBool($var); + $this->grounding_check_required = $var; + + return $this; + } + } diff --git a/DiscoveryEngine/src/V1beta/Client/CompletionServiceClient.php b/DiscoveryEngine/src/V1beta/Client/CompletionServiceClient.php index 21a3fe75d070..ec8e0f75a5d9 100644 --- a/DiscoveryEngine/src/V1beta/Client/CompletionServiceClient.php +++ b/DiscoveryEngine/src/V1beta/Client/CompletionServiceClient.php @@ -29,7 +29,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\ResourceHelperTrait; use Google\ApiCore\RetrySettings; @@ -40,6 +39,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\CompleteQueryResponse; use Google\Cloud\DiscoveryEngine\V1beta\ImportSuggestionDenyListEntriesRequest; use Google\Cloud\DiscoveryEngine\V1beta\PurgeSuggestionDenyListEntriesRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -143,6 +143,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a data_store * resource. diff --git a/DiscoveryEngine/src/V1beta/Client/ControlServiceClient.php b/DiscoveryEngine/src/V1beta/Client/ControlServiceClient.php new file mode 100644 index 000000000000..66295141017d --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Client/ControlServiceClient.php @@ -0,0 +1,572 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/control_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/control_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/control_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/control_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Formats a string containing the fully-qualified path to represent a control + * resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * @param string $control + * + * @return string The formatted control resource. + * + * @experimental + */ + public static function controlName(string $project, string $location, string $dataStore, string $control): string + { + return self::getPathTemplate('control')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + 'control' => $control, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a data_store + * resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted data_store resource. + * + * @experimental + */ + public static function dataStoreName(string $project, string $location, string $dataStore): string + { + return self::getPathTemplate('dataStore')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a engine + * resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $engine + * + * @return string The formatted engine resource. + * + * @experimental + */ + public static function engineName(string $project, string $location, string $collection, string $engine): string + { + return self::getPathTemplate('engine')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'engine' => $engine, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * + * @return string The formatted project_location_collection_data_store resource. + * + * @experimental + */ + public static function projectLocationCollectionDataStoreName( + string $project, + string $location, + string $collection, + string $dataStore + ): string { + return self::getPathTemplate('projectLocationCollectionDataStore')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store_control resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * @param string $control + * + * @return string The formatted project_location_collection_data_store_control resource. + * + * @experimental + */ + public static function projectLocationCollectionDataStoreControlName( + string $project, + string $location, + string $collection, + string $dataStore, + string $control + ): string { + return self::getPathTemplate('projectLocationCollectionDataStoreControl')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + 'control' => $control, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_engine_control resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $engine + * @param string $control + * + * @return string The formatted project_location_collection_engine_control resource. + * + * @experimental + */ + public static function projectLocationCollectionEngineControlName( + string $project, + string $location, + string $collection, + string $engine, + string $control + ): string { + return self::getPathTemplate('projectLocationCollectionEngineControl')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'engine' => $engine, + 'control' => $control, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted project_location_data_store resource. + * + * @experimental + */ + public static function projectLocationDataStoreName(string $project, string $location, string $dataStore): string + { + return self::getPathTemplate('projectLocationDataStore')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store_control resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * @param string $control + * + * @return string The formatted project_location_data_store_control resource. + * + * @experimental + */ + public static function projectLocationDataStoreControlName( + string $project, + string $location, + string $dataStore, + string $control + ): string { + return self::getPathTemplate('projectLocationDataStoreControl')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + 'control' => $control, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - control: projects/{project}/locations/{location}/dataStores/{data_store}/controls/{control} + * - dataStore: projects/{project}/locations/{location}/dataStores/{data_store} + * - engine: projects/{project}/locations/{location}/collections/{collection}/engines/{engine} + * - projectLocationCollectionDataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} + * - projectLocationCollectionDataStoreControl: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/controls/{control} + * - projectLocationCollectionEngineControl: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/controls/{control} + * - projectLocationDataStore: projects/{project}/locations/{location}/dataStores/{data_store} + * - projectLocationDataStoreControl: projects/{project}/locations/{location}/dataStores/{data_store}/controls/{control} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + * + * @experimental + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'discoveryengine.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Creates a Control. + * + * By default 1000 controls are allowed for a data store. + * A request can be submitted to adjust this limit. + * If the [Control][google.cloud.discoveryengine.v1beta.Control] to create + * already exists, an ALREADY_EXISTS error is returned. + * + * The async variant is {@see ControlServiceClient::createControlAsync()} . + * + * @example samples/V1beta/ControlServiceClient/create_control.php + * + * @param CreateControlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Control + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function createControl(CreateControlRequest $request, array $callOptions = []): Control + { + return $this->startApiCall('CreateControl', $request, $callOptions)->wait(); + } + + /** + * Deletes a Control. + * + * If the [Control][google.cloud.discoveryengine.v1beta.Control] to delete + * does not exist, a NOT_FOUND error is returned. + * + * The async variant is {@see ControlServiceClient::deleteControlAsync()} . + * + * @example samples/V1beta/ControlServiceClient/delete_control.php + * + * @param DeleteControlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function deleteControl(DeleteControlRequest $request, array $callOptions = []): void + { + $this->startApiCall('DeleteControl', $request, $callOptions)->wait(); + } + + /** + * Gets a Control. + * + * The async variant is {@see ControlServiceClient::getControlAsync()} . + * + * @example samples/V1beta/ControlServiceClient/get_control.php + * + * @param GetControlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Control + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function getControl(GetControlRequest $request, array $callOptions = []): Control + { + return $this->startApiCall('GetControl', $request, $callOptions)->wait(); + } + + /** + * Lists all Controls by their parent + * [DataStore][google.cloud.discoveryengine.v1beta.DataStore]. + * + * The async variant is {@see ControlServiceClient::listControlsAsync()} . + * + * @example samples/V1beta/ControlServiceClient/list_controls.php + * + * @param ListControlsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return PagedListResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function listControls(ListControlsRequest $request, array $callOptions = []): PagedListResponse + { + return $this->startApiCall('ListControls', $request, $callOptions); + } + + /** + * Updates a Control. + * + * [Control][google.cloud.discoveryengine.v1beta.Control] action type cannot + * be changed. If the [Control][google.cloud.discoveryengine.v1beta.Control] + * to update does not exist, a NOT_FOUND error is returned. + * + * The async variant is {@see ControlServiceClient::updateControlAsync()} . + * + * @example samples/V1beta/ControlServiceClient/update_control.php + * + * @param UpdateControlRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return Control + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function updateControl(UpdateControlRequest $request, array $callOptions = []): Control + { + return $this->startApiCall('UpdateControl', $request, $callOptions)->wait(); + } +} diff --git a/DiscoveryEngine/src/V1beta/Client/DataStoreServiceClient.php b/DiscoveryEngine/src/V1beta/Client/DataStoreServiceClient.php index d7d833b31852..726e28dc4d90 100644 --- a/DiscoveryEngine/src/V1beta/Client/DataStoreServiceClient.php +++ b/DiscoveryEngine/src/V1beta/Client/DataStoreServiceClient.php @@ -29,7 +29,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -43,6 +42,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\GetDataStoreRequest; use Google\Cloud\DiscoveryEngine\V1beta\ListDataStoresRequest; use Google\Cloud\DiscoveryEngine\V1beta\UpdateDataStoreRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -149,6 +149,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a collection * resource. diff --git a/DiscoveryEngine/src/V1beta/Client/DocumentServiceClient.php b/DiscoveryEngine/src/V1beta/Client/DocumentServiceClient.php index e403e742c8a8..10a9d4ff2433 100644 --- a/DiscoveryEngine/src/V1beta/Client/DocumentServiceClient.php +++ b/DiscoveryEngine/src/V1beta/Client/DocumentServiceClient.php @@ -29,7 +29,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -45,6 +44,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\ListDocumentsRequest; use Google\Cloud\DiscoveryEngine\V1beta\PurgeDocumentsRequest; use Google\Cloud\DiscoveryEngine\V1beta\UpdateDocumentRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -154,6 +154,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a branch * resource. @@ -541,7 +560,7 @@ public function getDocument(GetDocumentRequest $request, array $callOptions = [] /** * Bulk import of multiple * [Document][google.cloud.discoveryengine.v1beta.Document]s. Request - * processing may be synchronous. Non-existing items will be created. + * processing may be synchronous. Non-existing items are created. * * Note: It is possible for a subset of the * [Document][google.cloud.discoveryengine.v1beta.Document]s to be diff --git a/DiscoveryEngine/src/V1beta/Client/EngineServiceClient.php b/DiscoveryEngine/src/V1beta/Client/EngineServiceClient.php index e79ca683dc05..4e3d8f3aa556 100644 --- a/DiscoveryEngine/src/V1beta/Client/EngineServiceClient.php +++ b/DiscoveryEngine/src/V1beta/Client/EngineServiceClient.php @@ -29,7 +29,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -46,6 +45,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\ResumeEngineRequest; use Google\Cloud\DiscoveryEngine\V1beta\TuneEngineRequest; use Google\Cloud\DiscoveryEngine\V1beta\UpdateEngineRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -155,6 +155,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a collection * resource. diff --git a/DiscoveryEngine/src/V1beta/Client/ProjectServiceClient.php b/DiscoveryEngine/src/V1beta/Client/ProjectServiceClient.php new file mode 100644 index 000000000000..57d627162a28 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Client/ProjectServiceClient.php @@ -0,0 +1,311 @@ + self::SERVICE_NAME, + 'apiEndpoint' => self::SERVICE_ADDRESS . ':' . self::DEFAULT_SERVICE_PORT, + 'clientConfig' => __DIR__ . '/../resources/project_service_client_config.json', + 'descriptorsConfigPath' => __DIR__ . '/../resources/project_service_descriptor_config.php', + 'gcpApiConfigPath' => __DIR__ . '/../resources/project_service_grpc_config.json', + 'credentialsConfig' => [ + 'defaultScopes' => self::$serviceScopes, + ], + 'transportConfig' => [ + 'rest' => [ + 'restClientConfigPath' => __DIR__ . '/../resources/project_service_rest_client_config.php', + ], + ], + ]; + } + + /** + * Return an OperationsClient object with the same endpoint as $this. + * + * @return OperationsClient + * + * @experimental + */ + public function getOperationsClient() + { + return $this->operationsClient; + } + + /** + * Resume an existing long running operation that was previously started by a long + * running API method. If $methodName is not provided, or does not match a long + * running API method, then the operation can still be resumed, but the + * OperationResponse object will not deserialize the final response. + * + * @param string $operationName The name of the long running operation + * @param string $methodName The name of the method used to start the operation + * + * @return OperationResponse + * + * @experimental + */ + public function resumeOperation($operationName, $methodName = null) + { + $options = isset($this->descriptors[$methodName]['longRunning']) + ? $this->descriptors[$methodName]['longRunning'] + : []; + $operation = new OperationResponse($operationName, $this->getOperationsClient(), $options); + $operation->reload(); + return $operation; + } + + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + + /** + * Formats a string containing the fully-qualified path to represent a project + * resource. + * + * @param string $project + * + * @return string The formatted project resource. + * + * @experimental + */ + public static function projectName(string $project): string + { + return self::getPathTemplate('project')->render([ + 'project' => $project, + ]); + } + + /** + * Parses a formatted name string and returns an associative array of the components in the name. + * The following name formats are supported: + * Template: Pattern + * - project: projects/{project} + * + * The optional $template argument can be supplied to specify a particular pattern, + * and must match one of the templates listed above. If no $template argument is + * provided, or if the $template argument does not match one of the templates + * listed, then parseName will check each of the supported templates, and return + * the first match. + * + * @param string $formattedName The formatted name string + * @param string $template Optional name of template to match + * + * @return array An associative array from name component IDs to component values. + * + * @throws ValidationException If $formattedName could not be matched. + * + * @experimental + */ + public static function parseName(string $formattedName, string $template = null): array + { + return self::parseFormattedName($formattedName, $template); + } + + /** + * Constructor. + * + * @param array $options { + * Optional. Options for configuring the service API wrapper. + * + * @type string $apiEndpoint + * The address of the API remote host. May optionally include the port, formatted + * as ":". Default 'discoveryengine.googleapis.com:443'. + * @type string|array|FetchAuthTokenInterface|CredentialsWrapper $credentials + * The credentials to be used by the client to authorize API calls. This option + * accepts either a path to a credentials file, or a decoded credentials file as a + * PHP array. + * *Advanced usage*: In addition, this option can also accept a pre-constructed + * {@see \Google\Auth\FetchAuthTokenInterface} object or + * {@see \Google\ApiCore\CredentialsWrapper} object. Note that when one of these + * objects are provided, any settings in $credentialsConfig will be ignored. + * @type array $credentialsConfig + * Options used to configure credentials, including auth token caching, for the + * client. For a full list of supporting configuration options, see + * {@see \Google\ApiCore\CredentialsWrapper::build()} . + * @type bool $disableRetries + * Determines whether or not retries defined by the client configuration should be + * disabled. Defaults to `false`. + * @type string|array $clientConfig + * Client method configuration, including retry settings. This option can be either + * a path to a JSON file, or a PHP array containing the decoded JSON data. By + * default this settings points to the default client config file, which is + * provided in the resources folder. + * @type string|TransportInterface $transport + * The transport used for executing network requests. May be either the string + * `rest` or `grpc`. Defaults to `grpc` if gRPC support is detected on the system. + * *Advanced usage*: Additionally, it is possible to pass in an already + * instantiated {@see \Google\ApiCore\Transport\TransportInterface} object. Note + * that when this object is provided, any settings in $transportConfig, and any + * $apiEndpoint setting, will be ignored. + * @type array $transportConfig + * Configuration options that will be used to construct the transport. Options for + * each supported transport type should be passed in a key for that transport. For + * example: + * $transportConfig = [ + * 'grpc' => [...], + * 'rest' => [...], + * ]; + * See the {@see \Google\ApiCore\Transport\GrpcTransport::build()} and + * {@see \Google\ApiCore\Transport\RestTransport::build()} methods for the + * supported options. + * @type callable $clientCertSource + * A callable which returns the client cert as a string. This can be used to + * provide a certificate and private key to the transport layer for mTLS. + * } + * + * @throws ValidationException + * + * @experimental + */ + public function __construct(array $options = []) + { + $clientOptions = $this->buildClientOptions($options); + $this->setClientOptions($clientOptions); + $this->operationsClient = $this->createOperationsClient($clientOptions); + } + + /** Handles execution of the async variants for each documented method. */ + public function __call($method, $args) + { + if (substr($method, -5) !== 'Async') { + trigger_error('Call to undefined method ' . __CLASS__ . "::$method()", E_USER_ERROR); + } + + array_unshift($args, substr($method, 0, -5)); + return call_user_func_array([$this, 'startAsyncCall'], $args); + } + + /** + * Provisions the project resource. During the + * process, related systems will get prepared and initialized. + * + * Caller must read the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms), and optionally + * specify in request to provide consent to that service terms. + * + * The async variant is {@see ProjectServiceClient::provisionProjectAsync()} . + * + * @example samples/V1beta/ProjectServiceClient/provision_project.php + * + * @param ProvisionProjectRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return OperationResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function provisionProject(ProvisionProjectRequest $request, array $callOptions = []): OperationResponse + { + return $this->startApiCall('ProvisionProject', $request, $callOptions)->wait(); + } +} diff --git a/DiscoveryEngine/src/V1beta/Client/RecommendationServiceClient.php b/DiscoveryEngine/src/V1beta/Client/RecommendationServiceClient.php index bfef121a399b..e74869c81c95 100644 --- a/DiscoveryEngine/src/V1beta/Client/RecommendationServiceClient.php +++ b/DiscoveryEngine/src/V1beta/Client/RecommendationServiceClient.php @@ -99,6 +99,27 @@ private static function getClientDefaults() ]; } + /** + * Formats a string containing the fully-qualified path to represent a data_store + * resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted data_store resource. + * + * @experimental + */ + public static function dataStoreName(string $project, string $location, string $dataStore): string + { + return self::getPathTemplate('dataStore')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a document * resource. @@ -129,6 +150,56 @@ public static function documentName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a engine + * resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $engine + * + * @return string The formatted engine resource. + * + * @experimental + */ + public static function engineName(string $project, string $location, string $collection, string $engine): string + { + return self::getPathTemplate('engine')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'engine' => $engine, + ]); + } + + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_collection_data_store resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $dataStore + * + * @return string The formatted project_location_collection_data_store resource. + * + * @experimental + */ + public static function projectLocationCollectionDataStoreName( + string $project, + string $location, + string $collection, + string $dataStore + ): string { + return self::getPathTemplate('projectLocationCollectionDataStore')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_collection_data_store_branch_document resource. @@ -222,6 +293,27 @@ public static function projectLocationCollectionEngineServingConfigName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a + * project_location_data_store resource. + * + * @param string $project + * @param string $location + * @param string $dataStore + * + * @return string The formatted project_location_data_store resource. + * + * @experimental + */ + public static function projectLocationDataStoreName(string $project, string $location, string $dataStore): string + { + return self::getPathTemplate('projectLocationDataStore')->render([ + 'project' => $project, + 'location' => $location, + 'data_store' => $dataStore, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_data_store_branch_document resource. @@ -310,10 +402,14 @@ public static function servingConfigName( * Parses a formatted name string and returns an associative array of the components in the name. * The following name formats are supported: * Template: Pattern + * - dataStore: projects/{project}/locations/{location}/dataStores/{data_store} * - document: projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document} + * - engine: projects/{project}/locations/{location}/collections/{collection}/engines/{engine} + * - projectLocationCollectionDataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} * - projectLocationCollectionDataStoreBranchDocument: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document} * - projectLocationCollectionDataStoreServingConfig: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config} * - projectLocationCollectionEngineServingConfig: projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config} + * - projectLocationDataStore: projects/{project}/locations/{location}/dataStores/{data_store} * - projectLocationDataStoreBranchDocument: projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document} * - projectLocationDataStoreServingConfig: projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config} * - servingConfig: projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config} diff --git a/DiscoveryEngine/src/V1beta/Client/SchemaServiceClient.php b/DiscoveryEngine/src/V1beta/Client/SchemaServiceClient.php index 512c034eb285..524a942150ad 100644 --- a/DiscoveryEngine/src/V1beta/Client/SchemaServiceClient.php +++ b/DiscoveryEngine/src/V1beta/Client/SchemaServiceClient.php @@ -29,7 +29,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -43,6 +42,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\ListSchemasRequest; use Google\Cloud\DiscoveryEngine\V1beta\Schema; use Google\Cloud\DiscoveryEngine\V1beta\UpdateSchemaRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -148,6 +148,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a data_store * resource. diff --git a/DiscoveryEngine/src/V1beta/Client/SearchTuningServiceClient.php b/DiscoveryEngine/src/V1beta/Client/SearchTuningServiceClient.php index 1aba3b43056f..820a8254ff3d 100644 --- a/DiscoveryEngine/src/V1beta/Client/SearchTuningServiceClient.php +++ b/DiscoveryEngine/src/V1beta/Client/SearchTuningServiceClient.php @@ -29,14 +29,16 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\ResourceHelperTrait; use Google\ApiCore\RetrySettings; use Google\ApiCore\Transport\TransportInterface; use Google\ApiCore\ValidationException; use Google\Auth\FetchAuthTokenInterface; +use Google\Cloud\DiscoveryEngine\V1beta\ListCustomModelsRequest; +use Google\Cloud\DiscoveryEngine\V1beta\ListCustomModelsResponse; use Google\Cloud\DiscoveryEngine\V1beta\TrainCustomModelRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -53,6 +55,7 @@ * * @experimental * + * @method PromiseInterface listCustomModelsAsync(ListCustomModelsRequest $request, array $optionalArgs = []) * @method PromiseInterface trainCustomModelAsync(TrainCustomModelRequest $request, array $optionalArgs = []) */ final class SearchTuningServiceClient @@ -138,6 +141,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a data_store * resource. @@ -309,6 +331,36 @@ public function __call($method, $args) return call_user_func_array([$this, 'startAsyncCall'], $args); } + /** + * Gets a list of all the custom models. + * + * The async variant is {@see SearchTuningServiceClient::listCustomModelsAsync()} . + * + * @example samples/V1beta/SearchTuningServiceClient/list_custom_models.php + * + * @param ListCustomModelsRequest $request A request to house fields associated with the call. + * @param array $callOptions { + * Optional. + * + * @type RetrySettings|array $retrySettings + * Retry settings to use for this call. Can be a {@see RetrySettings} object, or an + * associative array of retry settings parameters. See the documentation on + * {@see RetrySettings} for example usage. + * } + * + * @return ListCustomModelsResponse + * + * @throws ApiException Thrown if the API call fails. + * + * @experimental + */ + public function listCustomModels( + ListCustomModelsRequest $request, + array $callOptions = [] + ): ListCustomModelsResponse { + return $this->startApiCall('ListCustomModels', $request, $callOptions)->wait(); + } + /** * Trains a custom model. * diff --git a/DiscoveryEngine/src/V1beta/Client/SiteSearchEngineServiceClient.php b/DiscoveryEngine/src/V1beta/Client/SiteSearchEngineServiceClient.php index 72fc2c5f8ac7..688ff13687ec 100644 --- a/DiscoveryEngine/src/V1beta/Client/SiteSearchEngineServiceClient.php +++ b/DiscoveryEngine/src/V1beta/Client/SiteSearchEngineServiceClient.php @@ -29,7 +29,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\PagedListResponse; use Google\ApiCore\ResourceHelperTrait; @@ -51,6 +50,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\SiteSearchEngine; use Google\Cloud\DiscoveryEngine\V1beta\TargetSite; use Google\Cloud\DiscoveryEngine\V1beta\UpdateTargetSiteRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -164,6 +164,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_collection_data_store_siteSearchEngine resource. diff --git a/DiscoveryEngine/src/V1beta/Client/UserEventServiceClient.php b/DiscoveryEngine/src/V1beta/Client/UserEventServiceClient.php index 4a7a098f29a2..f129c02efce8 100644 --- a/DiscoveryEngine/src/V1beta/Client/UserEventServiceClient.php +++ b/DiscoveryEngine/src/V1beta/Client/UserEventServiceClient.php @@ -29,7 +29,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\GapicClientTrait; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\OperationResponse; use Google\ApiCore\ResourceHelperTrait; use Google\ApiCore\RetrySettings; @@ -41,6 +40,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\ImportUserEventsRequest; use Google\Cloud\DiscoveryEngine\V1beta\UserEvent; use Google\Cloud\DiscoveryEngine\V1beta\WriteUserEventRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\Operation; use GuzzleHttp\Promise\PromiseInterface; @@ -144,6 +144,25 @@ public function resumeOperation($operationName, $methodName = null) return $operation; } + /** + * Create the default operation client for the service. + * + * @param array $options ClientOptions for the client. + * + * @return OperationsClient + */ + private function createOperationsClient(array $options) + { + // Unset client-specific configuration options + unset($options['serviceName'], $options['clientConfig'], $options['descriptorsConfigPath']); + + if (isset($options['operationsClient'])) { + return $options['operationsClient']; + } + + return new OperationsClient($options); + } + /** * Formats a string containing the fully-qualified path to represent a data_store * resource. @@ -195,6 +214,29 @@ public static function documentName( ]); } + /** + * Formats a string containing the fully-qualified path to represent a engine + * resource. + * + * @param string $project + * @param string $location + * @param string $collection + * @param string $engine + * + * @return string The formatted engine resource. + * + * @experimental + */ + public static function engineName(string $project, string $location, string $collection, string $engine): string + { + return self::getPathTemplate('engine')->render([ + 'project' => $project, + 'location' => $location, + 'collection' => $collection, + 'engine' => $engine, + ]); + } + /** * Formats a string containing the fully-qualified path to represent a * project_location_collection_data_store resource. @@ -312,6 +354,7 @@ public static function projectLocationDataStoreBranchDocumentName( * Template: Pattern * - dataStore: projects/{project}/locations/{location}/dataStores/{data_store} * - document: projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document} + * - engine: projects/{project}/locations/{location}/collections/{collection}/engines/{engine} * - projectLocationCollectionDataStore: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store} * - projectLocationCollectionDataStoreBranchDocument: projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document} * - projectLocationDataStore: projects/{project}/locations/{location}/dataStores/{data_store} @@ -444,7 +487,7 @@ public function collectUserEvent(CollectUserEventRequest $request, array $callOp } /** - * Bulk import of User events. Request processing might be + * Bulk import of user events. Request processing might be * synchronous. Events that already exist are skipped. * Use this method for backfilling historical user events. * diff --git a/DiscoveryEngine/src/V1beta/Condition.php b/DiscoveryEngine/src/V1beta/Condition.php new file mode 100644 index 000000000000..4858c778ffd5 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Condition.php @@ -0,0 +1,113 @@ +google.cloud.discoveryengine.v1beta.Condition + */ +class Condition extends \Google\Protobuf\Internal\Message +{ + /** + * Search only + * A list of terms to match the query on. + * Maximum of 10 query terms. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Condition.QueryTerm query_terms = 2; + */ + private $query_terms; + /** + * Range of time(s) specifying when condition is active. + * Maximum of 10 time ranges. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Condition.TimeRange active_time_range = 3; + */ + private $active_time_range; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DiscoveryEngine\V1beta\Condition\QueryTerm>|\Google\Protobuf\Internal\RepeatedField $query_terms + * Search only + * A list of terms to match the query on. + * Maximum of 10 query terms. + * @type array<\Google\Cloud\DiscoveryEngine\V1beta\Condition\TimeRange>|\Google\Protobuf\Internal\RepeatedField $active_time_range + * Range of time(s) specifying when condition is active. + * Maximum of 10 time ranges. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\Control::initOnce(); + parent::__construct($data); + } + + /** + * Search only + * A list of terms to match the query on. + * Maximum of 10 query terms. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Condition.QueryTerm query_terms = 2; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getQueryTerms() + { + return $this->query_terms; + } + + /** + * Search only + * A list of terms to match the query on. + * Maximum of 10 query terms. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Condition.QueryTerm query_terms = 2; + * @param array<\Google\Cloud\DiscoveryEngine\V1beta\Condition\QueryTerm>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setQueryTerms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1beta\Condition\QueryTerm::class); + $this->query_terms = $arr; + + return $this; + } + + /** + * Range of time(s) specifying when condition is active. + * Maximum of 10 time ranges. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Condition.TimeRange active_time_range = 3; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getActiveTimeRange() + { + return $this->active_time_range; + } + + /** + * Range of time(s) specifying when condition is active. + * Maximum of 10 time ranges. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Condition.TimeRange active_time_range = 3; + * @param array<\Google\Cloud\DiscoveryEngine\V1beta\Condition\TimeRange>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setActiveTimeRange($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1beta\Condition\TimeRange::class); + $this->active_time_range = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/Condition/QueryTerm.php b/DiscoveryEngine/src/V1beta/Condition/QueryTerm.php new file mode 100644 index 000000000000..b523cb578b81 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Condition/QueryTerm.php @@ -0,0 +1,118 @@ +google.cloud.discoveryengine.v1beta.Condition.QueryTerm + */ +class QueryTerm extends \Google\Protobuf\Internal\Message +{ + /** + * The specific query value to match against + * Must be lowercase, must be UTF-8. + * Can have at most 3 space separated terms if full_match is true. + * Cannot be an empty string. + * Maximum length of 5000 characters. + * + * Generated from protobuf field string value = 1; + */ + protected $value = ''; + /** + * Whether the search query needs to exactly match the query term. + * + * Generated from protobuf field bool full_match = 2; + */ + protected $full_match = false; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $value + * The specific query value to match against + * Must be lowercase, must be UTF-8. + * Can have at most 3 space separated terms if full_match is true. + * Cannot be an empty string. + * Maximum length of 5000 characters. + * @type bool $full_match + * Whether the search query needs to exactly match the query term. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\Control::initOnce(); + parent::__construct($data); + } + + /** + * The specific query value to match against + * Must be lowercase, must be UTF-8. + * Can have at most 3 space separated terms if full_match is true. + * Cannot be an empty string. + * Maximum length of 5000 characters. + * + * Generated from protobuf field string value = 1; + * @return string + */ + public function getValue() + { + return $this->value; + } + + /** + * The specific query value to match against + * Must be lowercase, must be UTF-8. + * Can have at most 3 space separated terms if full_match is true. + * Cannot be an empty string. + * Maximum length of 5000 characters. + * + * Generated from protobuf field string value = 1; + * @param string $var + * @return $this + */ + public function setValue($var) + { + GPBUtil::checkString($var, True); + $this->value = $var; + + return $this; + } + + /** + * Whether the search query needs to exactly match the query term. + * + * Generated from protobuf field bool full_match = 2; + * @return bool + */ + public function getFullMatch() + { + return $this->full_match; + } + + /** + * Whether the search query needs to exactly match the query term. + * + * Generated from protobuf field bool full_match = 2; + * @param bool $var + * @return $this + */ + public function setFullMatch($var) + { + GPBUtil::checkBool($var); + $this->full_match = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1beta/Condition/TimeRange.php b/DiscoveryEngine/src/V1beta/Condition/TimeRange.php new file mode 100644 index 000000000000..cd71e07854c2 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Condition/TimeRange.php @@ -0,0 +1,134 @@ +google.cloud.discoveryengine.v1beta.Condition.TimeRange + */ +class TimeRange extends \Google\Protobuf\Internal\Message +{ + /** + * Start of time range. + * Range is inclusive. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + */ + protected $start_time = null; + /** + * End of time range. + * Range is inclusive. + * Must be in the future. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + */ + protected $end_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Protobuf\Timestamp $start_time + * Start of time range. + * Range is inclusive. + * @type \Google\Protobuf\Timestamp $end_time + * End of time range. + * Range is inclusive. + * Must be in the future. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\Control::initOnce(); + parent::__construct($data); + } + + /** + * Start of time range. + * Range is inclusive. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @return \Google\Protobuf\Timestamp|null + */ + public function getStartTime() + { + return $this->start_time; + } + + public function hasStartTime() + { + return isset($this->start_time); + } + + public function clearStartTime() + { + unset($this->start_time); + } + + /** + * Start of time range. + * Range is inclusive. + * + * Generated from protobuf field .google.protobuf.Timestamp start_time = 1; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->start_time = $var; + + return $this; + } + + /** + * End of time range. + * Range is inclusive. + * Must be in the future. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @return \Google\Protobuf\Timestamp|null + */ + public function getEndTime() + { + return $this->end_time; + } + + public function hasEndTime() + { + return isset($this->end_time); + } + + public function clearEndTime() + { + unset($this->end_time); + } + + /** + * End of time range. + * Range is inclusive. + * Must be in the future. + * + * Generated from protobuf field .google.protobuf.Timestamp end_time = 2; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setEndTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->end_time = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1beta/Control.php b/DiscoveryEngine/src/V1beta/Control.php new file mode 100644 index 000000000000..80c0c28037a9 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Control.php @@ -0,0 +1,448 @@ +google.cloud.discoveryengine.v1beta.Control + */ +class Control extends \Google\Protobuf\Internal\Message +{ + /** + * Immutable. Fully qualified name + * `projects/*/locations/global/dataStore/*/controls/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + */ + protected $name = ''; + /** + * Required. Human readable name. The identifier used in UI views. + * Must be UTF-8 encoded string. Length limit is 128 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $display_name = ''; + /** + * Output only. List of all + * [ServingConfig][google.cloud.discoveryengine.v1beta.ServingConfig] ids this + * control is attached to. May take up to 10 minutes to update after changes. + * + * Generated from protobuf field repeated string associated_serving_config_ids = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $associated_serving_config_ids; + /** + * Required. Immutable. What solution the control belongs to. + * Must be compatible with vertical of resource. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.SolutionType solution_type = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + */ + protected $solution_type = 0; + /** + * Specifies the use case for the control. + * Affects what condition fields can be set. + * Only applies to + * [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH]. + * Currently only allow one use case per control. + * Must be set when solution_type is + * [SolutionType.SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH]. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchUseCase use_cases = 8; + */ + private $use_cases; + /** + * Determines when the associated action will trigger. + * Omit to always apply the action. + * Currently only a single condition may be specified. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Condition conditions = 5; + */ + private $conditions; + protected $action; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1beta\Control\BoostAction $boost_action + * Defines a boost-type control + * @type \Google\Cloud\DiscoveryEngine\V1beta\Control\FilterAction $filter_action + * Defines a filter-type control + * Currently not supported by Recommendation + * @type \Google\Cloud\DiscoveryEngine\V1beta\Control\RedirectAction $redirect_action + * Defines a redirect-type control. + * @type \Google\Cloud\DiscoveryEngine\V1beta\Control\SynonymsAction $synonyms_action + * Treats a group of terms as synonyms of one another. + * @type string $name + * Immutable. Fully qualified name + * `projects/*/locations/global/dataStore/*/controls/*` + * @type string $display_name + * Required. Human readable name. The identifier used in UI views. + * Must be UTF-8 encoded string. Length limit is 128 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * @type array|\Google\Protobuf\Internal\RepeatedField $associated_serving_config_ids + * Output only. List of all + * [ServingConfig][google.cloud.discoveryengine.v1beta.ServingConfig] ids this + * control is attached to. May take up to 10 minutes to update after changes. + * @type int $solution_type + * Required. Immutable. What solution the control belongs to. + * Must be compatible with vertical of resource. + * Otherwise an INVALID ARGUMENT error is thrown. + * @type array|\Google\Protobuf\Internal\RepeatedField $use_cases + * Specifies the use case for the control. + * Affects what condition fields can be set. + * Only applies to + * [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH]. + * Currently only allow one use case per control. + * Must be set when solution_type is + * [SolutionType.SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH]. + * @type array<\Google\Cloud\DiscoveryEngine\V1beta\Condition>|\Google\Protobuf\Internal\RepeatedField $conditions + * Determines when the associated action will trigger. + * Omit to always apply the action. + * Currently only a single condition may be specified. + * Otherwise an INVALID ARGUMENT error is thrown. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\Control::initOnce(); + parent::__construct($data); + } + + /** + * Defines a boost-type control + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control.BoostAction boost_action = 6; + * @return \Google\Cloud\DiscoveryEngine\V1beta\Control\BoostAction|null + */ + public function getBoostAction() + { + return $this->readOneof(6); + } + + public function hasBoostAction() + { + return $this->hasOneof(6); + } + + /** + * Defines a boost-type control + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control.BoostAction boost_action = 6; + * @param \Google\Cloud\DiscoveryEngine\V1beta\Control\BoostAction $var + * @return $this + */ + public function setBoostAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1beta\Control\BoostAction::class); + $this->writeOneof(6, $var); + + return $this; + } + + /** + * Defines a filter-type control + * Currently not supported by Recommendation + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control.FilterAction filter_action = 7; + * @return \Google\Cloud\DiscoveryEngine\V1beta\Control\FilterAction|null + */ + public function getFilterAction() + { + return $this->readOneof(7); + } + + public function hasFilterAction() + { + return $this->hasOneof(7); + } + + /** + * Defines a filter-type control + * Currently not supported by Recommendation + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control.FilterAction filter_action = 7; + * @param \Google\Cloud\DiscoveryEngine\V1beta\Control\FilterAction $var + * @return $this + */ + public function setFilterAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1beta\Control\FilterAction::class); + $this->writeOneof(7, $var); + + return $this; + } + + /** + * Defines a redirect-type control. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control.RedirectAction redirect_action = 9; + * @return \Google\Cloud\DiscoveryEngine\V1beta\Control\RedirectAction|null + */ + public function getRedirectAction() + { + return $this->readOneof(9); + } + + public function hasRedirectAction() + { + return $this->hasOneof(9); + } + + /** + * Defines a redirect-type control. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control.RedirectAction redirect_action = 9; + * @param \Google\Cloud\DiscoveryEngine\V1beta\Control\RedirectAction $var + * @return $this + */ + public function setRedirectAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1beta\Control\RedirectAction::class); + $this->writeOneof(9, $var); + + return $this; + } + + /** + * Treats a group of terms as synonyms of one another. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control.SynonymsAction synonyms_action = 10; + * @return \Google\Cloud\DiscoveryEngine\V1beta\Control\SynonymsAction|null + */ + public function getSynonymsAction() + { + return $this->readOneof(10); + } + + public function hasSynonymsAction() + { + return $this->hasOneof(10); + } + + /** + * Treats a group of terms as synonyms of one another. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control.SynonymsAction synonyms_action = 10; + * @param \Google\Cloud\DiscoveryEngine\V1beta\Control\SynonymsAction $var + * @return $this + */ + public function setSynonymsAction($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1beta\Control\SynonymsAction::class); + $this->writeOneof(10, $var); + + return $this; + } + + /** + * Immutable. Fully qualified name + * `projects/*/locations/global/dataStore/*/controls/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Immutable. Fully qualified name + * `projects/*/locations/global/dataStore/*/controls/*` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. Human readable name. The identifier used in UI views. + * Must be UTF-8 encoded string. Length limit is 128 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * Required. Human readable name. The identifier used in UI views. + * Must be UTF-8 encoded string. Length limit is 128 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string display_name = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * Output only. List of all + * [ServingConfig][google.cloud.discoveryengine.v1beta.ServingConfig] ids this + * control is attached to. May take up to 10 minutes to update after changes. + * + * Generated from protobuf field repeated string associated_serving_config_ids = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getAssociatedServingConfigIds() + { + return $this->associated_serving_config_ids; + } + + /** + * Output only. List of all + * [ServingConfig][google.cloud.discoveryengine.v1beta.ServingConfig] ids this + * control is attached to. May take up to 10 minutes to update after changes. + * + * Generated from protobuf field repeated string associated_serving_config_ids = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setAssociatedServingConfigIds($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->associated_serving_config_ids = $arr; + + return $this; + } + + /** + * Required. Immutable. What solution the control belongs to. + * Must be compatible with vertical of resource. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.SolutionType solution_type = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @return int + */ + public function getSolutionType() + { + return $this->solution_type; + } + + /** + * Required. Immutable. What solution the control belongs to. + * Must be compatible with vertical of resource. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.SolutionType solution_type = 4 [(.google.api.field_behavior) = REQUIRED, (.google.api.field_behavior) = IMMUTABLE]; + * @param int $var + * @return $this + */ + public function setSolutionType($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DiscoveryEngine\V1beta\SolutionType::class); + $this->solution_type = $var; + + return $this; + } + + /** + * Specifies the use case for the control. + * Affects what condition fields can be set. + * Only applies to + * [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH]. + * Currently only allow one use case per control. + * Must be set when solution_type is + * [SolutionType.SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH]. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchUseCase use_cases = 8; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getUseCases() + { + return $this->use_cases; + } + + /** + * Specifies the use case for the control. + * Affects what condition fields can be set. + * Only applies to + * [SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH]. + * Currently only allow one use case per control. + * Must be set when solution_type is + * [SolutionType.SOLUTION_TYPE_SEARCH][google.cloud.discoveryengine.v1beta.SolutionType.SOLUTION_TYPE_SEARCH]. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchUseCase use_cases = 8; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setUseCases($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::ENUM, \Google\Cloud\DiscoveryEngine\V1beta\SearchUseCase::class); + $this->use_cases = $arr; + + return $this; + } + + /** + * Determines when the associated action will trigger. + * Omit to always apply the action. + * Currently only a single condition may be specified. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Condition conditions = 5; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getConditions() + { + return $this->conditions; + } + + /** + * Determines when the associated action will trigger. + * Omit to always apply the action. + * Currently only a single condition may be specified. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Condition conditions = 5; + * @param array<\Google\Cloud\DiscoveryEngine\V1beta\Condition>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setConditions($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1beta\Condition::class); + $this->conditions = $arr; + + return $this; + } + + /** + * @return string + */ + public function getAction() + { + return $this->whichOneof("action"); + } + +} + diff --git a/DiscoveryEngine/src/V1beta/Control/BoostAction.php b/DiscoveryEngine/src/V1beta/Control/BoostAction.php new file mode 100644 index 000000000000..0f7d8300659a --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Control/BoostAction.php @@ -0,0 +1,168 @@ +google.cloud.discoveryengine.v1beta.Control.BoostAction + */ +class BoostAction extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Strength of the boost, which should be in [-1, 1]. Negative + * boost means demotion. Default is 0.0 (No-op). + * + * Generated from protobuf field float boost = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $boost = 0.0; + /** + * Required. Specifies which products to apply the boost to. + * If no filter is provided all products will be boosted (No-op). + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $filter = ''; + /** + * Required. Specifies which data store's documents can be boosted by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $data_store = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type float $boost + * Required. Strength of the boost, which should be in [-1, 1]. Negative + * boost means demotion. Default is 0.0 (No-op). + * @type string $filter + * Required. Specifies which products to apply the boost to. + * If no filter is provided all products will be boosted (No-op). + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * @type string $data_store + * Required. Specifies which data store's documents can be boosted by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\Control::initOnce(); + parent::__construct($data); + } + + /** + * Required. Strength of the boost, which should be in [-1, 1]. Negative + * boost means demotion. Default is 0.0 (No-op). + * + * Generated from protobuf field float boost = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return float + */ + public function getBoost() + { + return $this->boost; + } + + /** + * Required. Strength of the boost, which should be in [-1, 1]. Negative + * boost means demotion. Default is 0.0 (No-op). + * + * Generated from protobuf field float boost = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param float $var + * @return $this + */ + public function setBoost($var) + { + GPBUtil::checkFloat($var); + $this->boost = $var; + + return $this; + } + + /** + * Required. Specifies which products to apply the boost to. + * If no filter is provided all products will be boosted (No-op). + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Required. Specifies which products to apply the boost to. + * If no filter is provided all products will be boosted (No-op). + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Required. Specifies which data store's documents can be boosted by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDataStore() + { + return $this->data_store; + } + + /** + * Required. Specifies which data store's documents can be boosted by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 3 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDataStore($var) + { + GPBUtil::checkString($var, True); + $this->data_store = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1beta/Control/FilterAction.php b/DiscoveryEngine/src/V1beta/Control/FilterAction.php new file mode 100644 index 000000000000..1d07fe3fd72e --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Control/FilterAction.php @@ -0,0 +1,131 @@ +google.cloud.discoveryengine.v1beta.Control.FilterAction + */ +class FilterAction extends \Google\Protobuf\Internal\Message +{ + /** + * Required. A filter to apply on the matching condition results. + * Required + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. Otherwise an INVALID + * ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $filter = ''; + /** + * Required. Specifies which data store's documents can be filtered by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $data_store = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $filter + * Required. A filter to apply on the matching condition results. + * Required + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. Otherwise an INVALID + * ARGUMENT error is thrown. + * @type string $data_store + * Required. Specifies which data store's documents can be filtered by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\Control::initOnce(); + parent::__construct($data); + } + + /** + * Required. A filter to apply on the matching condition results. + * Required + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. Otherwise an INVALID + * ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Required. A filter to apply on the matching condition results. + * Required + * Syntax documentation: + * https://cloud.google.com/retail/docs/filter-and-order + * Maximum length is 5000 characters. Otherwise an INVALID + * ARGUMENT error is thrown. + * + * Generated from protobuf field string filter = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + + /** + * Required. Specifies which data store's documents can be filtered by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDataStore() + { + return $this->data_store; + } + + /** + * Required. Specifies which data store's documents can be filtered by this + * control. Full data store name e.g. + * projects/123/locations/global/collections/default_collection/dataStores/default_data_store + * + * Generated from protobuf field string data_store = 2 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDataStore($var) + { + GPBUtil::checkString($var, True); + $this->data_store = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1beta/Control/RedirectAction.php b/DiscoveryEngine/src/V1beta/Control/RedirectAction.php new file mode 100644 index 000000000000..39740c0c51b6 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Control/RedirectAction.php @@ -0,0 +1,80 @@ +google.cloud.discoveryengine.v1beta.Control.RedirectAction + */ +class RedirectAction extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The URI to which the shopper will be redirected. + * Required. + * URI must have length equal or less than 2000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string redirect_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $redirect_uri = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $redirect_uri + * Required. The URI to which the shopper will be redirected. + * Required. + * URI must have length equal or less than 2000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\Control::initOnce(); + parent::__construct($data); + } + + /** + * Required. The URI to which the shopper will be redirected. + * Required. + * URI must have length equal or less than 2000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string redirect_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getRedirectUri() + { + return $this->redirect_uri; + } + + /** + * Required. The URI to which the shopper will be redirected. + * Required. + * URI must have length equal or less than 2000 characters. + * Otherwise an INVALID ARGUMENT error is thrown. + * + * Generated from protobuf field string redirect_uri = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setRedirectUri($var) + { + GPBUtil::checkString($var, True); + $this->redirect_uri = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1beta/Control/SynonymsAction.php b/DiscoveryEngine/src/V1beta/Control/SynonymsAction.php new file mode 100644 index 000000000000..82f45ee05491 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Control/SynonymsAction.php @@ -0,0 +1,82 @@ +google.cloud.discoveryengine.v1beta.Control.SynonymsAction + */ +class SynonymsAction extends \Google\Protobuf\Internal\Message +{ + /** + * Defines a set of synonyms. + * Can specify up to 100 synonyms. + * Must specify at least 2 synonyms. Otherwise an INVALID ARGUMENT error is + * thrown. + * + * Generated from protobuf field repeated string synonyms = 1; + */ + private $synonyms; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array|\Google\Protobuf\Internal\RepeatedField $synonyms + * Defines a set of synonyms. + * Can specify up to 100 synonyms. + * Must specify at least 2 synonyms. Otherwise an INVALID ARGUMENT error is + * thrown. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\Control::initOnce(); + parent::__construct($data); + } + + /** + * Defines a set of synonyms. + * Can specify up to 100 synonyms. + * Must specify at least 2 synonyms. Otherwise an INVALID ARGUMENT error is + * thrown. + * + * Generated from protobuf field repeated string synonyms = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getSynonyms() + { + return $this->synonyms; + } + + /** + * Defines a set of synonyms. + * Can specify up to 100 synonyms. + * Must specify at least 2 synonyms. Otherwise an INVALID ARGUMENT error is + * thrown. + * + * Generated from protobuf field repeated string synonyms = 1; + * @param array|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setSynonyms($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::STRING); + $this->synonyms = $arr; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1beta/Conversation.php b/DiscoveryEngine/src/V1beta/Conversation.php index d8c2abd97ebb..45569a362720 100644 --- a/DiscoveryEngine/src/V1beta/Conversation.php +++ b/DiscoveryEngine/src/V1beta/Conversation.php @@ -17,9 +17,9 @@ class Conversation extends \Google\Protobuf\Internal\Message { /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/dataStore/*/conversations/*` + * `projects/{project}/locations/global/collections/{collection}/dataStore/*/conversations/*` * or - * `project/*/locations/global/collections/{collection}/engines/*/conversations/*`. + * `projects/{project}/locations/global/collections/{collection}/engines/*/conversations/*`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ @@ -63,9 +63,9 @@ class Conversation extends \Google\Protobuf\Internal\Message * * @type string $name * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/dataStore/*/conversations/*` + * `projects/{project}/locations/global/collections/{collection}/dataStore/*/conversations/*` * or - * `project/*/locations/global/collections/{collection}/engines/*/conversations/*`. + * `projects/{project}/locations/global/collections/{collection}/engines/*/conversations/*`. * @type int $state * The state of the Conversation. * @type string $user_pseudo_id @@ -85,9 +85,9 @@ public function __construct($data = NULL) { /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/dataStore/*/conversations/*` + * `projects/{project}/locations/global/collections/{collection}/dataStore/*/conversations/*` * or - * `project/*/locations/global/collections/{collection}/engines/*/conversations/*`. + * `projects/{project}/locations/global/collections/{collection}/engines/*/conversations/*`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * @return string @@ -99,9 +99,9 @@ public function getName() /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/dataStore/*/conversations/*` + * `projects/{project}/locations/global/collections/{collection}/dataStore/*/conversations/*` * or - * `project/*/locations/global/collections/{collection}/engines/*/conversations/*`. + * `projects/{project}/locations/global/collections/{collection}/engines/*/conversations/*`. * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * @param string $var diff --git a/DiscoveryEngine/src/V1beta/CreateControlRequest.php b/DiscoveryEngine/src/V1beta/CreateControlRequest.php new file mode 100644 index 000000000000..888cc3cbc56e --- /dev/null +++ b/DiscoveryEngine/src/V1beta/CreateControlRequest.php @@ -0,0 +1,194 @@ +google.cloud.discoveryengine.v1beta.CreateControlRequest + */ +class CreateControlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Required. The Control to create. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $control = null; + /** + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * This value must be within 1-63 characters. + * Valid characters are /[a-z][0-9]-_/. + * + * Generated from protobuf field string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $control_id = ''; + + /** + * @param string $parent Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. Please see + * {@see ControlServiceClient::dataStoreName()} for help formatting this field. + * @param \Google\Cloud\DiscoveryEngine\V1beta\Control $control Required. The Control to create. + * @param string $controlId Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * + * This value must be within 1-63 characters. + * Valid characters are /[a-z][0-9]-_/. + * + * @return \Google\Cloud\DiscoveryEngine\V1beta\CreateControlRequest + * + * @experimental + */ + public static function build(string $parent, \Google\Cloud\DiscoveryEngine\V1beta\Control $control, string $controlId): self + { + return (new self()) + ->setParent($parent) + ->setControl($control) + ->setControlId($controlId); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * @type \Google\Cloud\DiscoveryEngine\V1beta\Control $control + * Required. The Control to create. + * @type string $control_id + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * This value must be within 1-63 characters. + * Valid characters are /[a-z][0-9]-_/. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. Full resource name of parent data store. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Required. The Control to create. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\DiscoveryEngine\V1beta\Control|null + */ + public function getControl() + { + return $this->control; + } + + public function hasControl() + { + return isset($this->control); + } + + public function clearControl() + { + unset($this->control); + } + + /** + * Required. The Control to create. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control control = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\DiscoveryEngine\V1beta\Control $var + * @return $this + */ + public function setControl($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1beta\Control::class); + $this->control = $var; + + return $this; + } + + /** + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * This value must be within 1-63 characters. + * Valid characters are /[a-z][0-9]-_/. + * + * Generated from protobuf field string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getControlId() + { + return $this->control_id; + } + + /** + * Required. The ID to use for the Control, which will become the final + * component of the Control's resource name. + * This value must be within 1-63 characters. + * Valid characters are /[a-z][0-9]-_/. + * + * Generated from protobuf field string control_id = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setControlId($var) + { + GPBUtil::checkString($var, True); + $this->control_id = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/CreateDocumentRequest.php b/DiscoveryEngine/src/V1beta/CreateDocumentRequest.php index c3ff577a2b3d..a01c3853729a 100644 --- a/DiscoveryEngine/src/V1beta/CreateDocumentRequest.php +++ b/DiscoveryEngine/src/V1beta/CreateDocumentRequest.php @@ -33,8 +33,8 @@ class CreateDocumentRequest extends \Google\Protobuf\Internal\Message protected $document = null; /** * Required. The ID to use for the - * [Document][google.cloud.discoveryengine.v1beta.Document], which will become - * the final component of the + * [Document][google.cloud.discoveryengine.v1beta.Document], which becomes the + * final component of the * [Document.name][google.cloud.discoveryengine.v1beta.Document.name]. * If the caller does not have permission to create the * [Document][google.cloud.discoveryengine.v1beta.Document], regardless of @@ -58,8 +58,8 @@ class CreateDocumentRequest extends \Google\Protobuf\Internal\Message * @param \Google\Cloud\DiscoveryEngine\V1beta\Document $document Required. The [Document][google.cloud.discoveryengine.v1beta.Document] to * create. * @param string $documentId Required. The ID to use for the - * [Document][google.cloud.discoveryengine.v1beta.Document], which will become - * the final component of the + * [Document][google.cloud.discoveryengine.v1beta.Document], which becomes the + * final component of the * [Document.name][google.cloud.discoveryengine.v1beta.Document.name]. * * If the caller does not have permission to create the @@ -101,8 +101,8 @@ public static function build(string $parent, \Google\Cloud\DiscoveryEngine\V1bet * create. * @type string $document_id * Required. The ID to use for the - * [Document][google.cloud.discoveryengine.v1beta.Document], which will become - * the final component of the + * [Document][google.cloud.discoveryengine.v1beta.Document], which becomes the + * final component of the * [Document.name][google.cloud.discoveryengine.v1beta.Document.name]. * If the caller does not have permission to create the * [Document][google.cloud.discoveryengine.v1beta.Document], regardless of @@ -189,8 +189,8 @@ public function setDocument($var) /** * Required. The ID to use for the - * [Document][google.cloud.discoveryengine.v1beta.Document], which will become - * the final component of the + * [Document][google.cloud.discoveryengine.v1beta.Document], which becomes the + * final component of the * [Document.name][google.cloud.discoveryengine.v1beta.Document.name]. * If the caller does not have permission to create the * [Document][google.cloud.discoveryengine.v1beta.Document], regardless of @@ -213,8 +213,8 @@ public function getDocumentId() /** * Required. The ID to use for the - * [Document][google.cloud.discoveryengine.v1beta.Document], which will become - * the final component of the + * [Document][google.cloud.discoveryengine.v1beta.Document], which becomes the + * final component of the * [Document.name][google.cloud.discoveryengine.v1beta.Document.name]. * If the caller does not have permission to create the * [Document][google.cloud.discoveryengine.v1beta.Document], regardless of diff --git a/DiscoveryEngine/src/V1beta/CreateSchemaRequest.php b/DiscoveryEngine/src/V1beta/CreateSchemaRequest.php index 2433a108c8b0..6e9203379e20 100644 --- a/DiscoveryEngine/src/V1beta/CreateSchemaRequest.php +++ b/DiscoveryEngine/src/V1beta/CreateSchemaRequest.php @@ -33,7 +33,7 @@ class CreateSchemaRequest extends \Google\Protobuf\Internal\Message protected $schema = null; /** * Required. The ID to use for the - * [Schema][google.cloud.discoveryengine.v1beta.Schema], which will become the + * [Schema][google.cloud.discoveryengine.v1beta.Schema], which becomes the * final component of the * [Schema.name][google.cloud.discoveryengine.v1beta.Schema.name]. * This field should conform to @@ -51,7 +51,7 @@ class CreateSchemaRequest extends \Google\Protobuf\Internal\Message * @param \Google\Cloud\DiscoveryEngine\V1beta\Schema $schema Required. The [Schema][google.cloud.discoveryengine.v1beta.Schema] to * create. * @param string $schemaId Required. The ID to use for the - * [Schema][google.cloud.discoveryengine.v1beta.Schema], which will become the + * [Schema][google.cloud.discoveryengine.v1beta.Schema], which becomes the * final component of the * [Schema.name][google.cloud.discoveryengine.v1beta.Schema.name]. * @@ -85,7 +85,7 @@ public static function build(string $parent, \Google\Cloud\DiscoveryEngine\V1bet * create. * @type string $schema_id * Required. The ID to use for the - * [Schema][google.cloud.discoveryengine.v1beta.Schema], which will become the + * [Schema][google.cloud.discoveryengine.v1beta.Schema], which becomes the * final component of the * [Schema.name][google.cloud.discoveryengine.v1beta.Schema.name]. * This field should conform to @@ -166,7 +166,7 @@ public function setSchema($var) /** * Required. The ID to use for the - * [Schema][google.cloud.discoveryengine.v1beta.Schema], which will become the + * [Schema][google.cloud.discoveryengine.v1beta.Schema], which becomes the * final component of the * [Schema.name][google.cloud.discoveryengine.v1beta.Schema.name]. * This field should conform to @@ -183,7 +183,7 @@ public function getSchemaId() /** * Required. The ID to use for the - * [Schema][google.cloud.discoveryengine.v1beta.Schema], which will become the + * [Schema][google.cloud.discoveryengine.v1beta.Schema], which becomes the * final component of the * [Schema.name][google.cloud.discoveryengine.v1beta.Schema.name]. * This field should conform to diff --git a/DiscoveryEngine/src/V1beta/CustomTuningModel.php b/DiscoveryEngine/src/V1beta/CustomTuningModel.php new file mode 100644 index 000000000000..2aa38393e8b7 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/CustomTuningModel.php @@ -0,0 +1,269 @@ +google.cloud.discoveryengine.v1beta.CustomTuningModel + */ +class CustomTuningModel extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The fully qualified resource name of the model. + * Format: + * `projects/{project_number}/locations/{location}/collections/{collection}/dataStores/{data_store}/customTuningModels/{custom_tuning_model}` + * model must be an alpha-numerical string with limit of 40 characters. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * The display name of the model. + * + * Generated from protobuf field string display_name = 2; + */ + protected $display_name = ''; + /** + * The version of the model. + * + * Generated from protobuf field int64 model_version = 3; + */ + protected $model_version = 0; + /** + * The state that the model is in (e.g.`TRAINING` or `TRAINING_FAILED`). + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.CustomTuningModel.ModelState model_state = 4; + */ + protected $model_state = 0; + /** + * Timestamp the Model was created at. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + */ + protected $create_time = null; + /** + * Timestamp the model training was initiated. + * + * Generated from protobuf field .google.protobuf.Timestamp training_start_time = 6; + */ + protected $training_start_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The fully qualified resource name of the model. + * Format: + * `projects/{project_number}/locations/{location}/collections/{collection}/dataStores/{data_store}/customTuningModels/{custom_tuning_model}` + * model must be an alpha-numerical string with limit of 40 characters. + * @type string $display_name + * The display name of the model. + * @type int|string $model_version + * The version of the model. + * @type int $model_state + * The state that the model is in (e.g.`TRAINING` or `TRAINING_FAILED`). + * @type \Google\Protobuf\Timestamp $create_time + * Timestamp the Model was created at. + * @type \Google\Protobuf\Timestamp $training_start_time + * Timestamp the model training was initiated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\CustomTuningModel::initOnce(); + parent::__construct($data); + } + + /** + * Required. The fully qualified resource name of the model. + * Format: + * `projects/{project_number}/locations/{location}/collections/{collection}/dataStores/{data_store}/customTuningModels/{custom_tuning_model}` + * model must be an alpha-numerical string with limit of 40 characters. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The fully qualified resource name of the model. + * Format: + * `projects/{project_number}/locations/{location}/collections/{collection}/dataStores/{data_store}/customTuningModels/{custom_tuning_model}` + * model must be an alpha-numerical string with limit of 40 characters. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * The display name of the model. + * + * Generated from protobuf field string display_name = 2; + * @return string + */ + public function getDisplayName() + { + return $this->display_name; + } + + /** + * The display name of the model. + * + * Generated from protobuf field string display_name = 2; + * @param string $var + * @return $this + */ + public function setDisplayName($var) + { + GPBUtil::checkString($var, True); + $this->display_name = $var; + + return $this; + } + + /** + * The version of the model. + * + * Generated from protobuf field int64 model_version = 3; + * @return int|string + */ + public function getModelVersion() + { + return $this->model_version; + } + + /** + * The version of the model. + * + * Generated from protobuf field int64 model_version = 3; + * @param int|string $var + * @return $this + */ + public function setModelVersion($var) + { + GPBUtil::checkInt64($var); + $this->model_version = $var; + + return $this; + } + + /** + * The state that the model is in (e.g.`TRAINING` or `TRAINING_FAILED`). + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.CustomTuningModel.ModelState model_state = 4; + * @return int + */ + public function getModelState() + { + return $this->model_state; + } + + /** + * The state that the model is in (e.g.`TRAINING` or `TRAINING_FAILED`). + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.CustomTuningModel.ModelState model_state = 4; + * @param int $var + * @return $this + */ + public function setModelState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DiscoveryEngine\V1beta\CustomTuningModel\ModelState::class); + $this->model_state = $var; + + return $this; + } + + /** + * Timestamp the Model was created at. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Timestamp the Model was created at. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Timestamp the model training was initiated. + * + * Generated from protobuf field .google.protobuf.Timestamp training_start_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getTrainingStartTime() + { + return $this->training_start_time; + } + + public function hasTrainingStartTime() + { + return isset($this->training_start_time); + } + + public function clearTrainingStartTime() + { + unset($this->training_start_time); + } + + /** + * Timestamp the model training was initiated. + * + * Generated from protobuf field .google.protobuf.Timestamp training_start_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setTrainingStartTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->training_start_time = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/CustomTuningModel/ModelState.php b/DiscoveryEngine/src/V1beta/CustomTuningModel/ModelState.php new file mode 100644 index 000000000000..a37b2f894427 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/CustomTuningModel/ModelState.php @@ -0,0 +1,83 @@ +google.cloud.discoveryengine.v1beta.CustomTuningModel.ModelState + */ +class ModelState +{ + /** + * Default value. + * + * Generated from protobuf enum MODEL_STATE_UNSPECIFIED = 0; + */ + const MODEL_STATE_UNSPECIFIED = 0; + /** + * The model is in a paused training state. + * + * Generated from protobuf enum TRAINING_PAUSED = 1; + */ + const TRAINING_PAUSED = 1; + /** + * The model is currently training. + * + * Generated from protobuf enum TRAINING = 2; + */ + const TRAINING = 2; + /** + * The model has successfully completed training. + * + * Generated from protobuf enum TRAINING_COMPLETE = 3; + */ + const TRAINING_COMPLETE = 3; + /** + * The model is ready for serving. + * + * Generated from protobuf enum READY_FOR_SERVING = 4; + */ + const READY_FOR_SERVING = 4; + /** + * The model training failed. + * + * Generated from protobuf enum TRAINING_FAILED = 5; + */ + const TRAINING_FAILED = 5; + + private static $valueToName = [ + self::MODEL_STATE_UNSPECIFIED => 'MODEL_STATE_UNSPECIFIED', + self::TRAINING_PAUSED => 'TRAINING_PAUSED', + self::TRAINING => 'TRAINING', + self::TRAINING_COMPLETE => 'TRAINING_COMPLETE', + self::READY_FOR_SERVING => 'READY_FOR_SERVING', + self::TRAINING_FAILED => 'TRAINING_FAILED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DiscoveryEngine/src/V1beta/DeleteControlRequest.php b/DiscoveryEngine/src/V1beta/DeleteControlRequest.php new file mode 100644 index 000000000000..33e5fead7e5a --- /dev/null +++ b/DiscoveryEngine/src/V1beta/DeleteControlRequest.php @@ -0,0 +1,86 @@ +google.cloud.discoveryengine.v1beta.DeleteControlRequest + */ +class DeleteControlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * Please see {@see ControlServiceClient::controlName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1beta\DeleteControlRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Control to delete. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/DocumentInfo.php b/DiscoveryEngine/src/V1beta/DocumentInfo.php index b1ebb5f48f29..4fbf5fff556d 100644 --- a/DiscoveryEngine/src/V1beta/DocumentInfo.php +++ b/DiscoveryEngine/src/V1beta/DocumentInfo.php @@ -17,7 +17,7 @@ class DocumentInfo extends \Google\Protobuf\Internal\Message { /** * Quantity of the Document associated with the user event. Defaults to 1. - * For example, this field will be 2 if two quantities of the same Document + * For example, this field is 2 if two quantities of the same Document * are involved in a `add-to-cart` event. * Required for events of the following event types: * * `add-to-cart` @@ -52,7 +52,7 @@ class DocumentInfo extends \Google\Protobuf\Internal\Message * allowed for website data stores. * @type int $quantity * Quantity of the Document associated with the user event. Defaults to 1. - * For example, this field will be 2 if two quantities of the same Document + * For example, this field is 2 if two quantities of the same Document * are involved in a `add-to-cart` event. * Required for events of the following event types: * * `add-to-cart` @@ -168,7 +168,7 @@ public function setUri($var) /** * Quantity of the Document associated with the user event. Defaults to 1. - * For example, this field will be 2 if two quantities of the same Document + * For example, this field is 2 if two quantities of the same Document * are involved in a `add-to-cart` event. * Required for events of the following event types: * * `add-to-cart` @@ -194,7 +194,7 @@ public function clearQuantity() /** * Quantity of the Document associated with the user event. Defaults to 1. - * For example, this field will be 2 if two quantities of the same Document + * For example, this field is 2 if two quantities of the same Document * are involved in a `add-to-cart` event. * Required for events of the following event types: * * `add-to-cart` diff --git a/DiscoveryEngine/src/V1beta/Engine.php b/DiscoveryEngine/src/V1beta/Engine.php index ca84494153cf..7c0781d60d8d 100644 --- a/DiscoveryEngine/src/V1beta/Engine.php +++ b/DiscoveryEngine/src/V1beta/Engine.php @@ -80,7 +80,7 @@ class Engine extends \Google\Protobuf\Internal\Message * The restriction of the Engine industry vertical is based on * [DataStore][google.cloud.discoveryengine.v1beta.DataStore]: If unspecified, * default to `GENERIC`. Vertical on Engine has to match vertical of the - * DataStore liniked to the engine. + * DataStore linked to the engine. * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.IndustryVertical industry_vertical = 16; */ @@ -156,7 +156,7 @@ class Engine extends \Google\Protobuf\Internal\Message * The restriction of the Engine industry vertical is based on * [DataStore][google.cloud.discoveryengine.v1beta.DataStore]: If unspecified, * default to `GENERIC`. Vertical on Engine has to match vertical of the - * DataStore liniked to the engine. + * DataStore linked to the engine. * @type \Google\Cloud\DiscoveryEngine\V1beta\Engine\CommonConfig $common_config * Common config spec that specifies the metadata of the engine. * } @@ -506,7 +506,7 @@ public function setSolutionType($var) * The restriction of the Engine industry vertical is based on * [DataStore][google.cloud.discoveryengine.v1beta.DataStore]: If unspecified, * default to `GENERIC`. Vertical on Engine has to match vertical of the - * DataStore liniked to the engine. + * DataStore linked to the engine. * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.IndustryVertical industry_vertical = 16; * @return int @@ -521,7 +521,7 @@ public function getIndustryVertical() * The restriction of the Engine industry vertical is based on * [DataStore][google.cloud.discoveryengine.v1beta.DataStore]: If unspecified, * default to `GENERIC`. Vertical on Engine has to match vertical of the - * DataStore liniked to the engine. + * DataStore linked to the engine. * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.IndustryVertical industry_vertical = 16; * @param int $var diff --git a/DiscoveryEngine/src/V1beta/Engine/CommonConfig.php b/DiscoveryEngine/src/V1beta/Engine/CommonConfig.php index 2ae81f8e75fc..eb89d466d8bc 100644 --- a/DiscoveryEngine/src/V1beta/Engine/CommonConfig.php +++ b/DiscoveryEngine/src/V1beta/Engine/CommonConfig.php @@ -16,10 +16,10 @@ class CommonConfig extends \Google\Protobuf\Internal\Message { /** - * Immutable. The name of the company, business or entity that is associated - * with the engine. Setting this may help improve LLM related features. + * The name of the company, business or entity that is associated with the + * engine. Setting this may help improve LLM related features. * - * Generated from protobuf field string company_name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * Generated from protobuf field string company_name = 1; */ protected $company_name = ''; @@ -30,8 +30,8 @@ class CommonConfig extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $company_name - * Immutable. The name of the company, business or entity that is associated - * with the engine. Setting this may help improve LLM related features. + * The name of the company, business or entity that is associated with the + * engine. Setting this may help improve LLM related features. * } */ public function __construct($data = NULL) { @@ -40,10 +40,10 @@ public function __construct($data = NULL) { } /** - * Immutable. The name of the company, business or entity that is associated - * with the engine. Setting this may help improve LLM related features. + * The name of the company, business or entity that is associated with the + * engine. Setting this may help improve LLM related features. * - * Generated from protobuf field string company_name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * Generated from protobuf field string company_name = 1; * @return string */ public function getCompanyName() @@ -52,10 +52,10 @@ public function getCompanyName() } /** - * Immutable. The name of the company, business or entity that is associated - * with the engine. Setting this may help improve LLM related features. + * The name of the company, business or entity that is associated with the + * engine. Setting this may help improve LLM related features. * - * Generated from protobuf field string company_name = 1 [(.google.api.field_behavior) = IMMUTABLE]; + * Generated from protobuf field string company_name = 1; * @param string $var * @return $this */ diff --git a/DiscoveryEngine/src/V1beta/FactChunk.php b/DiscoveryEngine/src/V1beta/FactChunk.php index e3f5d819aea5..5ce9ca58d125 100644 --- a/DiscoveryEngine/src/V1beta/FactChunk.php +++ b/DiscoveryEngine/src/V1beta/FactChunk.php @@ -30,6 +30,12 @@ class FactChunk extends \Google\Protobuf\Internal\Message * Generated from protobuf field string source = 2; */ protected $source = ''; + /** + * The index of this chunk. Currently, only used for the streaming mode. + * + * Generated from protobuf field int32 index = 4; + */ + protected $index = 0; /** * More fine-grained information for the source reference. * @@ -50,6 +56,8 @@ class FactChunk extends \Google\Protobuf\Internal\Message * from the GroundingFacts provided in the request then this field will * contain the index of the specific fact from which this chunk was * retrieved. + * @type int $index + * The index of this chunk. Currently, only used for the streaming mode. * @type array|\Google\Protobuf\Internal\MapField $source_metadata * More fine-grained information for the source reference. * } @@ -117,6 +125,32 @@ public function setSource($var) return $this; } + /** + * The index of this chunk. Currently, only used for the streaming mode. + * + * Generated from protobuf field int32 index = 4; + * @return int + */ + public function getIndex() + { + return $this->index; + } + + /** + * The index of this chunk. Currently, only used for the streaming mode. + * + * Generated from protobuf field int32 index = 4; + * @param int $var + * @return $this + */ + public function setIndex($var) + { + GPBUtil::checkInt32($var); + $this->index = $var; + + return $this; + } + /** * More fine-grained information for the source reference. * diff --git a/DiscoveryEngine/src/V1beta/FirestoreSource.php b/DiscoveryEngine/src/V1beta/FirestoreSource.php index 11818fe19a66..9bd5228207f6 100644 --- a/DiscoveryEngine/src/V1beta/FirestoreSource.php +++ b/DiscoveryEngine/src/V1beta/FirestoreSource.php @@ -31,8 +31,8 @@ class FirestoreSource extends \Google\Protobuf\Internal\Message */ protected $database_id = ''; /** - * Required. The Firestore collection to copy the data from with a length - * limit of 1,500 characters. + * Required. The Firestore collection (or entity) to copy the data from with a + * length limit of 1,500 characters. * * Generated from protobuf field string collection_id = 3 [(.google.api.field_behavior) = REQUIRED]; */ @@ -62,8 +62,8 @@ class FirestoreSource extends \Google\Protobuf\Internal\Message * Required. The Firestore database to copy the data from with a length limit * of 256 characters. * @type string $collection_id - * Required. The Firestore collection to copy the data from with a length - * limit of 1,500 characters. + * Required. The Firestore collection (or entity) to copy the data from with a + * length limit of 1,500 characters. * @type string $gcs_staging_dir * Intermediate Cloud Storage directory used for the import with a length * limit of 2,000 characters. Can be specified if one wants to have the @@ -136,8 +136,8 @@ public function setDatabaseId($var) } /** - * Required. The Firestore collection to copy the data from with a length - * limit of 1,500 characters. + * Required. The Firestore collection (or entity) to copy the data from with a + * length limit of 1,500 characters. * * Generated from protobuf field string collection_id = 3 [(.google.api.field_behavior) = REQUIRED]; * @return string @@ -148,8 +148,8 @@ public function getCollectionId() } /** - * Required. The Firestore collection to copy the data from with a length - * limit of 1,500 characters. + * Required. The Firestore collection (or entity) to copy the data from with a + * length limit of 1,500 characters. * * Generated from protobuf field string collection_id = 3 [(.google.api.field_behavior) = REQUIRED]; * @param string $var diff --git a/DiscoveryEngine/src/V1beta/GcsSource.php b/DiscoveryEngine/src/V1beta/GcsSource.php index 496120307c45..cbccd3b01fd0 100644 --- a/DiscoveryEngine/src/V1beta/GcsSource.php +++ b/DiscoveryEngine/src/V1beta/GcsSource.php @@ -16,7 +16,7 @@ class GcsSource extends \Google\Protobuf\Internal\Message { /** - * Required. Cloud Storage URIs to input files. URI can be up to + * Required. Cloud Storage URIs to input files. Each URI can be up to * 2000 characters long. URIs can match the full object path (for example, * `gs://bucket/directory/object.json`) or a pattern matching one or more * files, such as `gs://bucket/directory/*.json`. @@ -45,7 +45,7 @@ class GcsSource extends \Google\Protobuf\Internal\Message * [Schema][google.cloud.discoveryengine.v1beta.Schema] of the * data store. Each entry after the header is imported as a Document. * This can only be used by the GENERIC Data Store vertical. - * Supported values for user even imports: + * Supported values for user event imports: * * `user_event` (default): One JSON * [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent] per line. * @@ -60,7 +60,7 @@ class GcsSource extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type array|\Google\Protobuf\Internal\RepeatedField $input_uris - * Required. Cloud Storage URIs to input files. URI can be up to + * Required. Cloud Storage URIs to input files. Each URI can be up to * 2000 characters long. URIs can match the full object path (for example, * `gs://bucket/directory/object.json`) or a pattern matching one or more * files, such as `gs://bucket/directory/*.json`. @@ -85,7 +85,7 @@ class GcsSource extends \Google\Protobuf\Internal\Message * [Schema][google.cloud.discoveryengine.v1beta.Schema] of the * data store. Each entry after the header is imported as a Document. * This can only be used by the GENERIC Data Store vertical. - * Supported values for user even imports: + * Supported values for user event imports: * * `user_event` (default): One JSON * [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent] per line. * } @@ -96,7 +96,7 @@ public function __construct($data = NULL) { } /** - * Required. Cloud Storage URIs to input files. URI can be up to + * Required. Cloud Storage URIs to input files. Each URI can be up to * 2000 characters long. URIs can match the full object path (for example, * `gs://bucket/directory/object.json`) or a pattern matching one or more * files, such as `gs://bucket/directory/*.json`. @@ -113,7 +113,7 @@ public function getInputUris() } /** - * Required. Cloud Storage URIs to input files. URI can be up to + * Required. Cloud Storage URIs to input files. Each URI can be up to * 2000 characters long. URIs can match the full object path (for example, * `gs://bucket/directory/object.json`) or a pattern matching one or more * files, such as `gs://bucket/directory/*.json`. @@ -151,7 +151,7 @@ public function setInputUris($var) * [Schema][google.cloud.discoveryengine.v1beta.Schema] of the * data store. Each entry after the header is imported as a Document. * This can only be used by the GENERIC Data Store vertical. - * Supported values for user even imports: + * Supported values for user event imports: * * `user_event` (default): One JSON * [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent] per line. * @@ -181,7 +181,7 @@ public function getDataSchema() * [Schema][google.cloud.discoveryengine.v1beta.Schema] of the * data store. Each entry after the header is imported as a Document. * This can only be used by the GENERIC Data Store vertical. - * Supported values for user even imports: + * Supported values for user event imports: * * `user_event` (default): One JSON * [UserEvent][google.cloud.discoveryengine.v1beta.UserEvent] per line. * diff --git a/DiscoveryEngine/src/V1beta/GetControlRequest.php b/DiscoveryEngine/src/V1beta/GetControlRequest.php new file mode 100644 index 000000000000..d3c7964fc2f3 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/GetControlRequest.php @@ -0,0 +1,86 @@ +google.cloud.discoveryengine.v1beta.GetControlRequest + */ +class GetControlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + + /** + * @param string $name Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * Please see {@see ControlServiceClient::controlName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1beta\GetControlRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. The resource name of the Control to get. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}/controls/{control_id}` + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/ListControlsRequest.php b/DiscoveryEngine/src/V1beta/ListControlsRequest.php new file mode 100644 index 000000000000..4bacc6c23131 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/ListControlsRequest.php @@ -0,0 +1,218 @@ +google.cloud.discoveryengine.v1beta.ListControlsRequest + */ +class ListControlsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $parent = ''; + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_size = 0; + /** + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $page_token = ''; + /** + * Optional. A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * [filter][google.cloud.discoveryengine.v1beta.ListControlsRequest.filter] is + * unset. Currently this field is unsupported. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $filter = ''; + + /** + * @param string $parent Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. Please see + * {@see ControlServiceClient::dataStoreName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1beta\ListControlsRequest + * + * @experimental + */ + public static function build(string $parent): self + { + return (new self()) + ->setParent($parent); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $parent + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * @type int $page_size + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * @type string $page_token + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * @type string $filter + * Optional. A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * [filter][google.cloud.discoveryengine.v1beta.ListControlsRequest.filter] is + * unset. Currently this field is unsupported. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getParent() + { + return $this->parent; + } + + /** + * Required. The data store resource name. Format: + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/dataStores/{data_store_id}` + * or + * `projects/{project_number}/locations/{location_id}/collections/{collection_id}/engines/{engine_id}`. + * + * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setParent($var) + { + GPBUtil::checkString($var, True); + $this->parent = $var; + + return $this; + } + + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return int + */ + public function getPageSize() + { + return $this->page_size; + } + + /** + * Optional. Maximum number of results to return. If unspecified, defaults + * to 50. Max allowed value is 1000. + * + * Generated from protobuf field int32 page_size = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param int $var + * @return $this + */ + public function setPageSize($var) + { + GPBUtil::checkInt32($var); + $this->page_size = $var; + + return $this; + } + + /** + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getPageToken() + { + return $this->page_token; + } + + /** + * Optional. A page token, received from a previous `ListControls` call. + * Provide this to retrieve the subsequent page. + * + * Generated from protobuf field string page_token = 3 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setPageToken($var) + { + GPBUtil::checkString($var, True); + $this->page_token = $var; + + return $this; + } + + /** + * Optional. A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * [filter][google.cloud.discoveryengine.v1beta.ListControlsRequest.filter] is + * unset. Currently this field is unsupported. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @return string + */ + public function getFilter() + { + return $this->filter; + } + + /** + * Optional. A filter to apply on the list results. Supported features: + * * List all the products under the parent branch if + * [filter][google.cloud.discoveryengine.v1beta.ListControlsRequest.filter] is + * unset. Currently this field is unsupported. + * + * Generated from protobuf field string filter = 4 [(.google.api.field_behavior) = OPTIONAL]; + * @param string $var + * @return $this + */ + public function setFilter($var) + { + GPBUtil::checkString($var, True); + $this->filter = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/ListControlsResponse.php b/DiscoveryEngine/src/V1beta/ListControlsResponse.php new file mode 100644 index 000000000000..a27000867a72 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/ListControlsResponse.php @@ -0,0 +1,101 @@ +google.cloud.discoveryengine.v1beta.ListControlsResponse + */ +class ListControlsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * All the Controls for a given data store. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Control controls = 1; + */ + private $controls; + /** + * Pagination token, if not returned indicates the last page. + * + * Generated from protobuf field string next_page_token = 2; + */ + protected $next_page_token = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DiscoveryEngine\V1beta\Control>|\Google\Protobuf\Internal\RepeatedField $controls + * All the Controls for a given data store. + * @type string $next_page_token + * Pagination token, if not returned indicates the last page. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * All the Controls for a given data store. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Control controls = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getControls() + { + return $this->controls; + } + + /** + * All the Controls for a given data store. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.Control controls = 1; + * @param array<\Google\Cloud\DiscoveryEngine\V1beta\Control>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setControls($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1beta\Control::class); + $this->controls = $arr; + + return $this; + } + + /** + * Pagination token, if not returned indicates the last page. + * + * Generated from protobuf field string next_page_token = 2; + * @return string + */ + public function getNextPageToken() + { + return $this->next_page_token; + } + + /** + * Pagination token, if not returned indicates the last page. + * + * Generated from protobuf field string next_page_token = 2; + * @param string $var + * @return $this + */ + public function setNextPageToken($var) + { + GPBUtil::checkString($var, True); + $this->next_page_token = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/ListCustomModelsRequest.php b/DiscoveryEngine/src/V1beta/ListCustomModelsRequest.php new file mode 100644 index 000000000000..409b681ca842 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/ListCustomModelsRequest.php @@ -0,0 +1,81 @@ +google.cloud.discoveryengine.v1beta.ListCustomModelsRequest + */ +class ListCustomModelsRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The resource name of the parent Data Store, such as + * `projects/*/locations/global/collections/default_collection/dataStores/default_data_store`. + * This field is used to identify the data store where to fetch the models + * from. + * + * Generated from protobuf field string data_store = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $data_store = ''; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $data_store + * Required. The resource name of the parent Data Store, such as + * `projects/*/locations/global/collections/default_collection/dataStores/default_data_store`. + * This field is used to identify the data store where to fetch the models + * from. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\SearchTuningService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The resource name of the parent Data Store, such as + * `projects/*/locations/global/collections/default_collection/dataStores/default_data_store`. + * This field is used to identify the data store where to fetch the models + * from. + * + * Generated from protobuf field string data_store = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getDataStore() + { + return $this->data_store; + } + + /** + * Required. The resource name of the parent Data Store, such as + * `projects/*/locations/global/collections/default_collection/dataStores/default_data_store`. + * This field is used to identify the data store where to fetch the models + * from. + * + * Generated from protobuf field string data_store = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDataStore($var) + { + GPBUtil::checkString($var, True); + $this->data_store = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/ListCustomModelsResponse.php b/DiscoveryEngine/src/V1beta/ListCustomModelsResponse.php new file mode 100644 index 000000000000..1aad66067280 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/ListCustomModelsResponse.php @@ -0,0 +1,69 @@ +google.cloud.discoveryengine.v1beta.ListCustomModelsResponse + */ +class ListCustomModelsResponse extends \Google\Protobuf\Internal\Message +{ + /** + * List of custom tuning models. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.CustomTuningModel models = 1; + */ + private $models; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type array<\Google\Cloud\DiscoveryEngine\V1beta\CustomTuningModel>|\Google\Protobuf\Internal\RepeatedField $models + * List of custom tuning models. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\SearchTuningService::initOnce(); + parent::__construct($data); + } + + /** + * List of custom tuning models. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.CustomTuningModel models = 1; + * @return \Google\Protobuf\Internal\RepeatedField + */ + public function getModels() + { + return $this->models; + } + + /** + * List of custom tuning models. + * + * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.CustomTuningModel models = 1; + * @param array<\Google\Cloud\DiscoveryEngine\V1beta\CustomTuningModel>|\Google\Protobuf\Internal\RepeatedField $var + * @return $this + */ + public function setModels($var) + { + $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1beta\CustomTuningModel::class); + $this->models = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/ListDataStoresRequest.php b/DiscoveryEngine/src/V1beta/ListDataStoresRequest.php index 39dd831d0f20..80247f2792cd 100644 --- a/DiscoveryEngine/src/V1beta/ListDataStoresRequest.php +++ b/DiscoveryEngine/src/V1beta/ListDataStoresRequest.php @@ -53,8 +53,8 @@ class ListDataStoresRequest extends \Google\Protobuf\Internal\Message */ protected $page_token = ''; /** - * Filter by solution type. For example: filter = - * 'solution_type:SOLUTION_TYPE_SEARCH' + * Filter by solution type . + * For example: `filter = 'solution_type:SOLUTION_TYPE_SEARCH'` * * Generated from protobuf field string filter = 4; */ @@ -110,8 +110,8 @@ public static function build(string $parent): self * must match the call that provided the page token. Otherwise, an * INVALID_ARGUMENT error is returned. * @type string $filter - * Filter by solution type. For example: filter = - * 'solution_type:SOLUTION_TYPE_SEARCH' + * Filter by solution type . + * For example: `filter = 'solution_type:SOLUTION_TYPE_SEARCH'` * } */ public function __construct($data = NULL) { @@ -232,8 +232,8 @@ public function setPageToken($var) } /** - * Filter by solution type. For example: filter = - * 'solution_type:SOLUTION_TYPE_SEARCH' + * Filter by solution type . + * For example: `filter = 'solution_type:SOLUTION_TYPE_SEARCH'` * * Generated from protobuf field string filter = 4; * @return string @@ -244,8 +244,8 @@ public function getFilter() } /** - * Filter by solution type. For example: filter = - * 'solution_type:SOLUTION_TYPE_SEARCH' + * Filter by solution type . + * For example: `filter = 'solution_type:SOLUTION_TYPE_SEARCH'` * * Generated from protobuf field string filter = 4; * @param string $var diff --git a/DiscoveryEngine/src/V1beta/ListDocumentsRequest.php b/DiscoveryEngine/src/V1beta/ListDocumentsRequest.php index 2257b17f5bff..c7e88d10d26a 100644 --- a/DiscoveryEngine/src/V1beta/ListDocumentsRequest.php +++ b/DiscoveryEngine/src/V1beta/ListDocumentsRequest.php @@ -33,7 +33,7 @@ class ListDocumentsRequest extends \Google\Protobuf\Internal\Message /** * Maximum number of [Document][google.cloud.discoveryengine.v1beta.Document]s * to return. If unspecified, defaults to 100. The maximum allowed value is - * 1000. Values above 1000 will be coerced to 1000. + * 1000. Values above 1000 are set to 1000. * If this field is negative, an `INVALID_ARGUMENT` error is returned. * * Generated from protobuf field int32 page_size = 2; @@ -94,7 +94,7 @@ public static function build(string $parent): self * @type int $page_size * Maximum number of [Document][google.cloud.discoveryengine.v1beta.Document]s * to return. If unspecified, defaults to 100. The maximum allowed value is - * 1000. Values above 1000 will be coerced to 1000. + * 1000. Values above 1000 are set to 1000. * If this field is negative, an `INVALID_ARGUMENT` error is returned. * @type string $page_token * A page token @@ -156,7 +156,7 @@ public function setParent($var) /** * Maximum number of [Document][google.cloud.discoveryengine.v1beta.Document]s * to return. If unspecified, defaults to 100. The maximum allowed value is - * 1000. Values above 1000 will be coerced to 1000. + * 1000. Values above 1000 are set to 1000. * If this field is negative, an `INVALID_ARGUMENT` error is returned. * * Generated from protobuf field int32 page_size = 2; @@ -170,7 +170,7 @@ public function getPageSize() /** * Maximum number of [Document][google.cloud.discoveryengine.v1beta.Document]s * to return. If unspecified, defaults to 100. The maximum allowed value is - * 1000. Values above 1000 will be coerced to 1000. + * 1000. Values above 1000 are set to 1000. * If this field is negative, an `INVALID_ARGUMENT` error is returned. * * Generated from protobuf field int32 page_size = 2; diff --git a/DiscoveryEngine/src/V1beta/ListSchemasRequest.php b/DiscoveryEngine/src/V1beta/ListSchemasRequest.php index d1de3973ccbd..f22fd559254c 100644 --- a/DiscoveryEngine/src/V1beta/ListSchemasRequest.php +++ b/DiscoveryEngine/src/V1beta/ListSchemasRequest.php @@ -28,8 +28,8 @@ class ListSchemasRequest extends \Google\Protobuf\Internal\Message * The maximum number of [Schema][google.cloud.discoveryengine.v1beta.Schema]s * to return. The service may return fewer than this value. * If unspecified, at most 100 - * [Schema][google.cloud.discoveryengine.v1beta.Schema]s will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * [Schema][google.cloud.discoveryengine.v1beta.Schema]s are returned. + * The maximum value is 1000; values above 1000 are set to 1000. * * Generated from protobuf field int32 page_size = 2; */ @@ -74,8 +74,8 @@ public static function build(string $parent): self * The maximum number of [Schema][google.cloud.discoveryengine.v1beta.Schema]s * to return. The service may return fewer than this value. * If unspecified, at most 100 - * [Schema][google.cloud.discoveryengine.v1beta.Schema]s will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * [Schema][google.cloud.discoveryengine.v1beta.Schema]s are returned. + * The maximum value is 1000; values above 1000 are set to 1000. * @type string $page_token * A page token, received from a previous * [SchemaService.ListSchemas][google.cloud.discoveryengine.v1beta.SchemaService.ListSchemas] @@ -122,8 +122,8 @@ public function setParent($var) * The maximum number of [Schema][google.cloud.discoveryengine.v1beta.Schema]s * to return. The service may return fewer than this value. * If unspecified, at most 100 - * [Schema][google.cloud.discoveryengine.v1beta.Schema]s will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * [Schema][google.cloud.discoveryengine.v1beta.Schema]s are returned. + * The maximum value is 1000; values above 1000 are set to 1000. * * Generated from protobuf field int32 page_size = 2; * @return int @@ -137,8 +137,8 @@ public function getPageSize() * The maximum number of [Schema][google.cloud.discoveryengine.v1beta.Schema]s * to return. The service may return fewer than this value. * If unspecified, at most 100 - * [Schema][google.cloud.discoveryengine.v1beta.Schema]s will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. + * [Schema][google.cloud.discoveryengine.v1beta.Schema]s are returned. + * The maximum value is 1000; values above 1000 are set to 1000. * * Generated from protobuf field int32 page_size = 2; * @param int $var diff --git a/DiscoveryEngine/src/V1beta/Project.php b/DiscoveryEngine/src/V1beta/Project.php new file mode 100644 index 000000000000..93dcf38a2db0 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Project.php @@ -0,0 +1,213 @@ +google.cloud.discoveryengine.v1beta.Project + */ +class Project extends \Google\Protobuf\Internal\Message +{ + /** + * Output only. Full resource name of the project, for example + * `projects/{project_number}`. + * Note that when making requests, project number and project id are both + * acceptable, but the server will always respond in project number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $name = ''; + /** + * Output only. The timestamp when this project is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $create_time = null; + /** + * Output only. The timestamp when this project is successfully provisioned. + * Empty value means this project is still provisioning and is not ready for + * use. + * + * Generated from protobuf field .google.protobuf.Timestamp provision_completion_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $provision_completion_time = null; + /** + * Output only. A map of terms of services. The key is the `id` of + * [ServiceTerms][google.cloud.discoveryengine.v1beta.Project.ServiceTerms]. + * + * Generated from protobuf field map service_terms_map = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + private $service_terms_map; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Output only. Full resource name of the project, for example + * `projects/{project_number}`. + * Note that when making requests, project number and project id are both + * acceptable, but the server will always respond in project number. + * @type \Google\Protobuf\Timestamp $create_time + * Output only. The timestamp when this project is created. + * @type \Google\Protobuf\Timestamp $provision_completion_time + * Output only. The timestamp when this project is successfully provisioned. + * Empty value means this project is still provisioning and is not ready for + * use. + * @type array|\Google\Protobuf\Internal\MapField $service_terms_map + * Output only. A map of terms of services. The key is the `id` of + * [ServiceTerms][google.cloud.discoveryengine.v1beta.Project.ServiceTerms]. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\Project::initOnce(); + parent::__construct($data); + } + + /** + * Output only. Full resource name of the project, for example + * `projects/{project_number}`. + * Note that when making requests, project number and project id are both + * acceptable, but the server will always respond in project number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Output only. Full resource name of the project, for example + * `projects/{project_number}`. + * Note that when making requests, project number and project id are both + * acceptable, but the server will always respond in project number. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Output only. The timestamp when this project is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getCreateTime() + { + return $this->create_time; + } + + public function hasCreateTime() + { + return isset($this->create_time); + } + + public function clearCreateTime() + { + unset($this->create_time); + } + + /** + * Output only. The timestamp when this project is created. + * + * Generated from protobuf field .google.protobuf.Timestamp create_time = 2 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setCreateTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->create_time = $var; + + return $this; + } + + /** + * Output only. The timestamp when this project is successfully provisioned. + * Empty value means this project is still provisioning and is not ready for + * use. + * + * Generated from protobuf field .google.protobuf.Timestamp provision_completion_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Timestamp|null + */ + public function getProvisionCompletionTime() + { + return $this->provision_completion_time; + } + + public function hasProvisionCompletionTime() + { + return isset($this->provision_completion_time); + } + + public function clearProvisionCompletionTime() + { + unset($this->provision_completion_time); + } + + /** + * Output only. The timestamp when this project is successfully provisioned. + * Empty value means this project is still provisioning and is not ready for + * use. + * + * Generated from protobuf field .google.protobuf.Timestamp provision_completion_time = 3 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setProvisionCompletionTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->provision_completion_time = $var; + + return $this; + } + + /** + * Output only. A map of terms of services. The key is the `id` of + * [ServiceTerms][google.cloud.discoveryengine.v1beta.Project.ServiceTerms]. + * + * Generated from protobuf field map service_terms_map = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return \Google\Protobuf\Internal\MapField + */ + public function getServiceTermsMap() + { + return $this->service_terms_map; + } + + /** + * Output only. A map of terms of services. The key is the `id` of + * [ServiceTerms][google.cloud.discoveryengine.v1beta.Project.ServiceTerms]. + * + * Generated from protobuf field map service_terms_map = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setServiceTermsMap($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::MESSAGE, \Google\Cloud\DiscoveryEngine\V1beta\Project\ServiceTerms::class); + $this->service_terms_map = $arr; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/Project/ServiceTerms.php b/DiscoveryEngine/src/V1beta/Project/ServiceTerms.php new file mode 100644 index 000000000000..78898046044f --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Project/ServiceTerms.php @@ -0,0 +1,264 @@ +google.cloud.discoveryengine.v1beta.Project.ServiceTerms + */ +class ServiceTerms extends \Google\Protobuf\Internal\Message +{ + /** + * The unique identifier of this terms of service. + * Available terms: + * * `GA_DATA_USE_TERMS`: [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). When using this as + * `id`, the acceptable + * [version][google.cloud.discoveryengine.v1beta.Project.ServiceTerms.version] + * to provide is `2022-11-23`. + * + * Generated from protobuf field string id = 1; + */ + protected $id = ''; + /** + * The version string of the terms of service. + * For acceptable values, see the comments for + * [id][google.cloud.discoveryengine.v1beta.Project.ServiceTerms.id] above. + * + * Generated from protobuf field string version = 2; + */ + protected $version = ''; + /** + * Whether the project has accepted/rejected the service terms or it is + * still pending. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Project.ServiceTerms.State state = 4; + */ + protected $state = 0; + /** + * The last time when the project agreed to the terms of service. + * + * Generated from protobuf field .google.protobuf.Timestamp accept_time = 5; + */ + protected $accept_time = null; + /** + * The last time when the project declined or revoked the agreement to terms + * of service. + * + * Generated from protobuf field .google.protobuf.Timestamp decline_time = 6; + */ + protected $decline_time = null; + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $id + * The unique identifier of this terms of service. + * Available terms: + * * `GA_DATA_USE_TERMS`: [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). When using this as + * `id`, the acceptable + * [version][google.cloud.discoveryengine.v1beta.Project.ServiceTerms.version] + * to provide is `2022-11-23`. + * @type string $version + * The version string of the terms of service. + * For acceptable values, see the comments for + * [id][google.cloud.discoveryengine.v1beta.Project.ServiceTerms.id] above. + * @type int $state + * Whether the project has accepted/rejected the service terms or it is + * still pending. + * @type \Google\Protobuf\Timestamp $accept_time + * The last time when the project agreed to the terms of service. + * @type \Google\Protobuf\Timestamp $decline_time + * The last time when the project declined or revoked the agreement to terms + * of service. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\Project::initOnce(); + parent::__construct($data); + } + + /** + * The unique identifier of this terms of service. + * Available terms: + * * `GA_DATA_USE_TERMS`: [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). When using this as + * `id`, the acceptable + * [version][google.cloud.discoveryengine.v1beta.Project.ServiceTerms.version] + * to provide is `2022-11-23`. + * + * Generated from protobuf field string id = 1; + * @return string + */ + public function getId() + { + return $this->id; + } + + /** + * The unique identifier of this terms of service. + * Available terms: + * * `GA_DATA_USE_TERMS`: [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). When using this as + * `id`, the acceptable + * [version][google.cloud.discoveryengine.v1beta.Project.ServiceTerms.version] + * to provide is `2022-11-23`. + * + * Generated from protobuf field string id = 1; + * @param string $var + * @return $this + */ + public function setId($var) + { + GPBUtil::checkString($var, True); + $this->id = $var; + + return $this; + } + + /** + * The version string of the terms of service. + * For acceptable values, see the comments for + * [id][google.cloud.discoveryengine.v1beta.Project.ServiceTerms.id] above. + * + * Generated from protobuf field string version = 2; + * @return string + */ + public function getVersion() + { + return $this->version; + } + + /** + * The version string of the terms of service. + * For acceptable values, see the comments for + * [id][google.cloud.discoveryengine.v1beta.Project.ServiceTerms.id] above. + * + * Generated from protobuf field string version = 2; + * @param string $var + * @return $this + */ + public function setVersion($var) + { + GPBUtil::checkString($var, True); + $this->version = $var; + + return $this; + } + + /** + * Whether the project has accepted/rejected the service terms or it is + * still pending. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Project.ServiceTerms.State state = 4; + * @return int + */ + public function getState() + { + return $this->state; + } + + /** + * Whether the project has accepted/rejected the service terms or it is + * still pending. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Project.ServiceTerms.State state = 4; + * @param int $var + * @return $this + */ + public function setState($var) + { + GPBUtil::checkEnum($var, \Google\Cloud\DiscoveryEngine\V1beta\Project\ServiceTerms\State::class); + $this->state = $var; + + return $this; + } + + /** + * The last time when the project agreed to the terms of service. + * + * Generated from protobuf field .google.protobuf.Timestamp accept_time = 5; + * @return \Google\Protobuf\Timestamp|null + */ + public function getAcceptTime() + { + return $this->accept_time; + } + + public function hasAcceptTime() + { + return isset($this->accept_time); + } + + public function clearAcceptTime() + { + unset($this->accept_time); + } + + /** + * The last time when the project agreed to the terms of service. + * + * Generated from protobuf field .google.protobuf.Timestamp accept_time = 5; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setAcceptTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->accept_time = $var; + + return $this; + } + + /** + * The last time when the project declined or revoked the agreement to terms + * of service. + * + * Generated from protobuf field .google.protobuf.Timestamp decline_time = 6; + * @return \Google\Protobuf\Timestamp|null + */ + public function getDeclineTime() + { + return $this->decline_time; + } + + public function hasDeclineTime() + { + return isset($this->decline_time); + } + + public function clearDeclineTime() + { + unset($this->decline_time); + } + + /** + * The last time when the project declined or revoked the agreement to terms + * of service. + * + * Generated from protobuf field .google.protobuf.Timestamp decline_time = 6; + * @param \Google\Protobuf\Timestamp $var + * @return $this + */ + public function setDeclineTime($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\Timestamp::class); + $this->decline_time = $var; + + return $this; + } + +} + + diff --git a/DiscoveryEngine/src/V1beta/Project/ServiceTerms/State.php b/DiscoveryEngine/src/V1beta/Project/ServiceTerms/State.php new file mode 100644 index 000000000000..ed1e9fe64ac3 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/Project/ServiceTerms/State.php @@ -0,0 +1,69 @@ +google.cloud.discoveryengine.v1beta.Project.ServiceTerms.State + */ +class State +{ + /** + * The default value of the enum. This value is not actually used. + * + * Generated from protobuf enum STATE_UNSPECIFIED = 0; + */ + const STATE_UNSPECIFIED = 0; + /** + * The project has given consent to the terms of service. + * + * Generated from protobuf enum TERMS_ACCEPTED = 1; + */ + const TERMS_ACCEPTED = 1; + /** + * The project is pending to review and accept the terms of service. + * + * Generated from protobuf enum TERMS_PENDING = 2; + */ + const TERMS_PENDING = 2; + /** + * The project has declined or revoked the agreement to terms of service. + * + * Generated from protobuf enum TERMS_DECLINED = 3; + */ + const TERMS_DECLINED = 3; + + private static $valueToName = [ + self::STATE_UNSPECIFIED => 'STATE_UNSPECIFIED', + self::TERMS_ACCEPTED => 'TERMS_ACCEPTED', + self::TERMS_PENDING => 'TERMS_PENDING', + self::TERMS_DECLINED => 'TERMS_DECLINED', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + + diff --git a/DiscoveryEngine/src/V1beta/ProvisionProjectMetadata.php b/DiscoveryEngine/src/V1beta/ProvisionProjectMetadata.php new file mode 100644 index 000000000000..4cd0d36f3454 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/ProvisionProjectMetadata.php @@ -0,0 +1,33 @@ +google.cloud.discoveryengine.v1beta.ProvisionProjectMetadata + */ +class ProvisionProjectMetadata extends \Google\Protobuf\Internal\Message +{ + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\ProjectService::initOnce(); + parent::__construct($data); + } + +} + diff --git a/DiscoveryEngine/src/V1beta/ProvisionProjectRequest.php b/DiscoveryEngine/src/V1beta/ProvisionProjectRequest.php new file mode 100644 index 000000000000..b78f3a4eb854 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/ProvisionProjectRequest.php @@ -0,0 +1,181 @@ +google.cloud.discoveryengine.v1beta.ProvisionProjectRequest + */ +class ProvisionProjectRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. Full resource name of a + * [Project][google.cloud.discoveryengine.v1beta.Project], such as + * `projects/{project_id_or_number}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + */ + protected $name = ''; + /** + * Required. Set to `true` to specify that caller has read and would like to + * give consent to the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). + * + * Generated from protobuf field bool accept_data_use_terms = 2 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $accept_data_use_terms = false; + /** + * Required. The version of the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms) that caller has read + * and would like to give consent to. + * Acceptable version is `2022-11-23`, and this may change over time. + * + * Generated from protobuf field string data_use_terms_version = 3 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $data_use_terms_version = ''; + + /** + * @param string $name Required. Full resource name of a + * [Project][google.cloud.discoveryengine.v1beta.Project], such as + * `projects/{project_id_or_number}`. Please see + * {@see ProjectServiceClient::projectName()} for help formatting this field. + * + * @return \Google\Cloud\DiscoveryEngine\V1beta\ProvisionProjectRequest + * + * @experimental + */ + public static function build(string $name): self + { + return (new self()) + ->setName($name); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type string $name + * Required. Full resource name of a + * [Project][google.cloud.discoveryengine.v1beta.Project], such as + * `projects/{project_id_or_number}`. + * @type bool $accept_data_use_terms + * Required. Set to `true` to specify that caller has read and would like to + * give consent to the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). + * @type string $data_use_terms_version + * Required. The version of the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms) that caller has read + * and would like to give consent to. + * Acceptable version is `2022-11-23`, and this may change over time. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\ProjectService::initOnce(); + parent::__construct($data); + } + + /** + * Required. Full resource name of a + * [Project][google.cloud.discoveryengine.v1beta.Project], such as + * `projects/{project_id_or_number}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Required. Full resource name of a + * [Project][google.cloud.discoveryengine.v1beta.Project], such as + * `projects/{project_id_or_number}`. + * + * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setName($var) + { + GPBUtil::checkString($var, True); + $this->name = $var; + + return $this; + } + + /** + * Required. Set to `true` to specify that caller has read and would like to + * give consent to the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). + * + * Generated from protobuf field bool accept_data_use_terms = 2 [(.google.api.field_behavior) = REQUIRED]; + * @return bool + */ + public function getAcceptDataUseTerms() + { + return $this->accept_data_use_terms; + } + + /** + * Required. Set to `true` to specify that caller has read and would like to + * give consent to the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms). + * + * Generated from protobuf field bool accept_data_use_terms = 2 [(.google.api.field_behavior) = REQUIRED]; + * @param bool $var + * @return $this + */ + public function setAcceptDataUseTerms($var) + { + GPBUtil::checkBool($var); + $this->accept_data_use_terms = $var; + + return $this; + } + + /** + * Required. The version of the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms) that caller has read + * and would like to give consent to. + * Acceptable version is `2022-11-23`, and this may change over time. + * + * Generated from protobuf field string data_use_terms_version = 3 [(.google.api.field_behavior) = REQUIRED]; + * @return string + */ + public function getDataUseTermsVersion() + { + return $this->data_use_terms_version; + } + + /** + * Required. The version of the [Terms for data + * use](https://cloud.google.com/retail/data-use-terms) that caller has read + * and would like to give consent to. + * Acceptable version is `2022-11-23`, and this may change over time. + * + * Generated from protobuf field string data_use_terms_version = 3 [(.google.api.field_behavior) = REQUIRED]; + * @param string $var + * @return $this + */ + public function setDataUseTermsVersion($var) + { + GPBUtil::checkString($var, True); + $this->data_use_terms_version = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/RankRequest.php b/DiscoveryEngine/src/V1beta/RankRequest.php index 2cc6bb409339..0c3c2d1458cf 100644 --- a/DiscoveryEngine/src/V1beta/RankRequest.php +++ b/DiscoveryEngine/src/V1beta/RankRequest.php @@ -59,6 +59,26 @@ class RankRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field bool ignore_record_details_in_response = 6; */ protected $ignore_record_details_in_response = false; + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 7; + */ + private $user_labels; /** * Constructor. @@ -84,6 +104,22 @@ class RankRequest extends \Google\Protobuf\Internal\Message * @type bool $ignore_record_details_in_response * If true, the response will contain only record ID and score. By default, it * is false, the response will contain record details. + * @type array|\Google\Protobuf\Internal\MapField $user_labels + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. * } */ public function __construct($data = NULL) { @@ -259,5 +295,59 @@ public function setIgnoreRecordDetailsInResponse($var) return $this; } + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 7; + * @return \Google\Protobuf\Internal\MapField + */ + public function getUserLabels() + { + return $this->user_labels; + } + + /** + * The user labels applied to a resource must meet the following requirements: + * * Each resource can have multiple labels, up to a maximum of 64. + * * Each label must be a key-value pair. + * * Keys have a minimum length of 1 character and a maximum length of 63 + * characters and cannot be empty. Values can be empty and have a maximum + * length of 63 characters. + * * Keys and values can contain only lowercase letters, numeric characters, + * underscores, and dashes. All characters must use UTF-8 encoding, and + * international characters are allowed. + * * The key portion of a label must be unique. However, you can use the same + * key with multiple resources. + * * Keys must start with a lowercase letter or international character. + * See [Google Cloud + * Document](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements) + * for more details. + * + * Generated from protobuf field map user_labels = 7; + * @param array|\Google\Protobuf\Internal\MapField $var + * @return $this + */ + public function setUserLabels($var) + { + $arr = GPBUtil::checkMapField($var, \Google\Protobuf\Internal\GPBType::STRING, \Google\Protobuf\Internal\GPBType::STRING); + $this->user_labels = $arr; + + return $this; + } + } diff --git a/DiscoveryEngine/src/V1beta/RecommendRequest.php b/DiscoveryEngine/src/V1beta/RecommendRequest.php index ea146a0ce30c..332187566fea 100644 --- a/DiscoveryEngine/src/V1beta/RecommendRequest.php +++ b/DiscoveryEngine/src/V1beta/RecommendRequest.php @@ -21,7 +21,7 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message * `projects/*/locations/global/collections/*/engines/*/servingConfigs/*`, or * `projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*` * One default serving config is created along with your recommendation engine - * creation. The engine ID will be used as the ID of the default serving + * creation. The engine ID is used as the ID of the default serving * config. For example, for Engine * `projects/*/locations/global/collections/*/engines/my-engine`, you can use * `projects/*/locations/global/collections/*/engines/my-engine/servingConfigs/my-engine` @@ -54,9 +54,9 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message protected $user_event = null; /** * Maximum number of results to return. Set this property - * to the number of recommendation results needed. If zero, the service will - * choose a reasonable default. The maximum allowed value is 100. Values - * above 100 will be coerced to 100. + * to the number of recommendation results needed. If zero, the service + * chooses a reasonable default. The maximum allowed value is 100. Values + * above 100 are set to 100. * * Generated from protobuf field int32 page_size = 3; */ @@ -74,21 +74,21 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message * * (launguage: ANY("en", "es")) AND NOT (categories: ANY("Movie")) * * (available: true) AND * (launguage: ANY("en", "es")) OR (categories: ANY("Movie")) - * If your filter blocks all results, the API will return generic + * If your filter blocks all results, the API returns generic * (unfiltered) popular Documents. If you only want results strictly matching - * the filters, set `strictFiltering` to True in + * the filters, set `strictFiltering` to `true` in * [RecommendRequest.params][google.cloud.discoveryengine.v1beta.RecommendRequest.params] * to receive empty results instead. - * Note that the API will never return + * Note that the API never returns * [Document][google.cloud.discoveryengine.v1beta.Document]s with - * `storageStatus` of `EXPIRED` or `DELETED` regardless of filter choices. + * `storageStatus` as `EXPIRED` or `DELETED` regardless of filter choices. * * Generated from protobuf field string filter = 4; */ protected $filter = ''; /** - * Use validate only mode for this recommendation query. If set to true, a - * fake model will be used that returns arbitrary Document IDs. + * Use validate only mode for this recommendation query. If set to `true`, a + * fake model is used that returns arbitrary Document IDs. * Note that the validate only mode should only be used for testing the API, * or if the model is not ready. * @@ -98,16 +98,17 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message /** * Additional domain specific parameters for the recommendations. * Allowed values: - * * `returnDocument`: Boolean. If set to true, the associated Document - * object will be returned in + * * `returnDocument`: Boolean. If set to `true`, the associated Document + * object is returned in * [RecommendResponse.RecommendationResult.document][google.cloud.discoveryengine.v1beta.RecommendResponse.RecommendationResult.document]. - * * `returnScore`: Boolean. If set to true, the recommendation 'score' - * corresponding to each returned Document will be set in + * * `returnScore`: Boolean. If set to true, the recommendation score + * corresponding to each returned Document is set in * [RecommendResponse.RecommendationResult.metadata][google.cloud.discoveryengine.v1beta.RecommendResponse.RecommendationResult.metadata]. - * The given 'score' indicates the probability of a Document conversion - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular Documents instead of empty if + * The given score indicates the probability of a Document conversion given + * the user's context and history. + * * `strictFiltering`: Boolean. True by default. If set to `false`, the + * service + * returns generic (unfiltered) popular Documents instead of empty if * your filter blocks all recommendation results. * * `diversityLevel`: String. Default empty. If set to be non-empty, then * it needs to be one of: @@ -158,7 +159,7 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message * `projects/*/locations/global/collections/*/engines/*/servingConfigs/*`, or * `projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*` * One default serving config is created along with your recommendation engine - * creation. The engine ID will be used as the ID of the default serving + * creation. The engine ID is used as the ID of the default serving * config. For example, for Engine * `projects/*/locations/global/collections/*/engines/my-engine`, you can use * `projects/*/locations/global/collections/*/engines/my-engine/servingConfigs/my-engine` @@ -183,9 +184,9 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message * unset. * @type int $page_size * Maximum number of results to return. Set this property - * to the number of recommendation results needed. If zero, the service will - * choose a reasonable default. The maximum allowed value is 100. Values - * above 100 will be coerced to 100. + * to the number of recommendation results needed. If zero, the service + * chooses a reasonable default. The maximum allowed value is 100. Values + * above 100 are set to 100. * @type string $filter * Filter for restricting recommendation results with a length limit of 5,000 * characters. Currently, only filter expressions on the `filter_tags` @@ -199,32 +200,33 @@ class RecommendRequest extends \Google\Protobuf\Internal\Message * * (launguage: ANY("en", "es")) AND NOT (categories: ANY("Movie")) * * (available: true) AND * (launguage: ANY("en", "es")) OR (categories: ANY("Movie")) - * If your filter blocks all results, the API will return generic + * If your filter blocks all results, the API returns generic * (unfiltered) popular Documents. If you only want results strictly matching - * the filters, set `strictFiltering` to True in + * the filters, set `strictFiltering` to `true` in * [RecommendRequest.params][google.cloud.discoveryengine.v1beta.RecommendRequest.params] * to receive empty results instead. - * Note that the API will never return + * Note that the API never returns * [Document][google.cloud.discoveryengine.v1beta.Document]s with - * `storageStatus` of `EXPIRED` or `DELETED` regardless of filter choices. + * `storageStatus` as `EXPIRED` or `DELETED` regardless of filter choices. * @type bool $validate_only - * Use validate only mode for this recommendation query. If set to true, a - * fake model will be used that returns arbitrary Document IDs. + * Use validate only mode for this recommendation query. If set to `true`, a + * fake model is used that returns arbitrary Document IDs. * Note that the validate only mode should only be used for testing the API, * or if the model is not ready. * @type array|\Google\Protobuf\Internal\MapField $params * Additional domain specific parameters for the recommendations. * Allowed values: - * * `returnDocument`: Boolean. If set to true, the associated Document - * object will be returned in + * * `returnDocument`: Boolean. If set to `true`, the associated Document + * object is returned in * [RecommendResponse.RecommendationResult.document][google.cloud.discoveryengine.v1beta.RecommendResponse.RecommendationResult.document]. - * * `returnScore`: Boolean. If set to true, the recommendation 'score' - * corresponding to each returned Document will be set in + * * `returnScore`: Boolean. If set to true, the recommendation score + * corresponding to each returned Document is set in * [RecommendResponse.RecommendationResult.metadata][google.cloud.discoveryengine.v1beta.RecommendResponse.RecommendationResult.metadata]. - * The given 'score' indicates the probability of a Document conversion - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular Documents instead of empty if + * The given score indicates the probability of a Document conversion given + * the user's context and history. + * * `strictFiltering`: Boolean. True by default. If set to `false`, the + * service + * returns generic (unfiltered) popular Documents instead of empty if * your filter blocks all recommendation results. * * `diversityLevel`: String. Default empty. If set to be non-empty, then * it needs to be one of: @@ -267,7 +269,7 @@ public function __construct($data = NULL) { * `projects/*/locations/global/collections/*/engines/*/servingConfigs/*`, or * `projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*` * One default serving config is created along with your recommendation engine - * creation. The engine ID will be used as the ID of the default serving + * creation. The engine ID is used as the ID of the default serving * config. For example, for Engine * `projects/*/locations/global/collections/*/engines/my-engine`, you can use * `projects/*/locations/global/collections/*/engines/my-engine/servingConfigs/my-engine` @@ -289,7 +291,7 @@ public function getServingConfig() * `projects/*/locations/global/collections/*/engines/*/servingConfigs/*`, or * `projects/*/locations/global/collections/*/dataStores/*/servingConfigs/*` * One default serving config is created along with your recommendation engine - * creation. The engine ID will be used as the ID of the default serving + * creation. The engine ID is used as the ID of the default serving * config. For example, for Engine * `projects/*/locations/global/collections/*/engines/my-engine`, you can use * `projects/*/locations/global/collections/*/engines/my-engine/servingConfigs/my-engine` @@ -375,9 +377,9 @@ public function setUserEvent($var) /** * Maximum number of results to return. Set this property - * to the number of recommendation results needed. If zero, the service will - * choose a reasonable default. The maximum allowed value is 100. Values - * above 100 will be coerced to 100. + * to the number of recommendation results needed. If zero, the service + * chooses a reasonable default. The maximum allowed value is 100. Values + * above 100 are set to 100. * * Generated from protobuf field int32 page_size = 3; * @return int @@ -389,9 +391,9 @@ public function getPageSize() /** * Maximum number of results to return. Set this property - * to the number of recommendation results needed. If zero, the service will - * choose a reasonable default. The maximum allowed value is 100. Values - * above 100 will be coerced to 100. + * to the number of recommendation results needed. If zero, the service + * chooses a reasonable default. The maximum allowed value is 100. Values + * above 100 are set to 100. * * Generated from protobuf field int32 page_size = 3; * @param int $var @@ -418,14 +420,14 @@ public function setPageSize($var) * * (launguage: ANY("en", "es")) AND NOT (categories: ANY("Movie")) * * (available: true) AND * (launguage: ANY("en", "es")) OR (categories: ANY("Movie")) - * If your filter blocks all results, the API will return generic + * If your filter blocks all results, the API returns generic * (unfiltered) popular Documents. If you only want results strictly matching - * the filters, set `strictFiltering` to True in + * the filters, set `strictFiltering` to `true` in * [RecommendRequest.params][google.cloud.discoveryengine.v1beta.RecommendRequest.params] * to receive empty results instead. - * Note that the API will never return + * Note that the API never returns * [Document][google.cloud.discoveryengine.v1beta.Document]s with - * `storageStatus` of `EXPIRED` or `DELETED` regardless of filter choices. + * `storageStatus` as `EXPIRED` or `DELETED` regardless of filter choices. * * Generated from protobuf field string filter = 4; * @return string @@ -448,14 +450,14 @@ public function getFilter() * * (launguage: ANY("en", "es")) AND NOT (categories: ANY("Movie")) * * (available: true) AND * (launguage: ANY("en", "es")) OR (categories: ANY("Movie")) - * If your filter blocks all results, the API will return generic + * If your filter blocks all results, the API returns generic * (unfiltered) popular Documents. If you only want results strictly matching - * the filters, set `strictFiltering` to True in + * the filters, set `strictFiltering` to `true` in * [RecommendRequest.params][google.cloud.discoveryengine.v1beta.RecommendRequest.params] * to receive empty results instead. - * Note that the API will never return + * Note that the API never returns * [Document][google.cloud.discoveryengine.v1beta.Document]s with - * `storageStatus` of `EXPIRED` or `DELETED` regardless of filter choices. + * `storageStatus` as `EXPIRED` or `DELETED` regardless of filter choices. * * Generated from protobuf field string filter = 4; * @param string $var @@ -470,8 +472,8 @@ public function setFilter($var) } /** - * Use validate only mode for this recommendation query. If set to true, a - * fake model will be used that returns arbitrary Document IDs. + * Use validate only mode for this recommendation query. If set to `true`, a + * fake model is used that returns arbitrary Document IDs. * Note that the validate only mode should only be used for testing the API, * or if the model is not ready. * @@ -484,8 +486,8 @@ public function getValidateOnly() } /** - * Use validate only mode for this recommendation query. If set to true, a - * fake model will be used that returns arbitrary Document IDs. + * Use validate only mode for this recommendation query. If set to `true`, a + * fake model is used that returns arbitrary Document IDs. * Note that the validate only mode should only be used for testing the API, * or if the model is not ready. * @@ -504,16 +506,17 @@ public function setValidateOnly($var) /** * Additional domain specific parameters for the recommendations. * Allowed values: - * * `returnDocument`: Boolean. If set to true, the associated Document - * object will be returned in + * * `returnDocument`: Boolean. If set to `true`, the associated Document + * object is returned in * [RecommendResponse.RecommendationResult.document][google.cloud.discoveryengine.v1beta.RecommendResponse.RecommendationResult.document]. - * * `returnScore`: Boolean. If set to true, the recommendation 'score' - * corresponding to each returned Document will be set in + * * `returnScore`: Boolean. If set to true, the recommendation score + * corresponding to each returned Document is set in * [RecommendResponse.RecommendationResult.metadata][google.cloud.discoveryengine.v1beta.RecommendResponse.RecommendationResult.metadata]. - * The given 'score' indicates the probability of a Document conversion - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular Documents instead of empty if + * The given score indicates the probability of a Document conversion given + * the user's context and history. + * * `strictFiltering`: Boolean. True by default. If set to `false`, the + * service + * returns generic (unfiltered) popular Documents instead of empty if * your filter blocks all recommendation results. * * `diversityLevel`: String. Default empty. If set to be non-empty, then * it needs to be one of: @@ -539,16 +542,17 @@ public function getParams() /** * Additional domain specific parameters for the recommendations. * Allowed values: - * * `returnDocument`: Boolean. If set to true, the associated Document - * object will be returned in + * * `returnDocument`: Boolean. If set to `true`, the associated Document + * object is returned in * [RecommendResponse.RecommendationResult.document][google.cloud.discoveryengine.v1beta.RecommendResponse.RecommendationResult.document]. - * * `returnScore`: Boolean. If set to true, the recommendation 'score' - * corresponding to each returned Document will be set in + * * `returnScore`: Boolean. If set to true, the recommendation score + * corresponding to each returned Document is set in * [RecommendResponse.RecommendationResult.metadata][google.cloud.discoveryengine.v1beta.RecommendResponse.RecommendationResult.metadata]. - * The given 'score' indicates the probability of a Document conversion - * given the user's context and history. - * * `strictFiltering`: Boolean. True by default. If set to false, the service - * will return generic (unfiltered) popular Documents instead of empty if + * The given score indicates the probability of a Document conversion given + * the user's context and history. + * * `strictFiltering`: Boolean. True by default. If set to `false`, the + * service + * returns generic (unfiltered) popular Documents instead of empty if * your filter blocks all recommendation results. * * `diversityLevel`: String. Default empty. If set to be non-empty, then * it needs to be one of: diff --git a/DiscoveryEngine/src/V1beta/RecommendResponse/RecommendationResult.php b/DiscoveryEngine/src/V1beta/RecommendResponse/RecommendationResult.php index 1f9f2f67608b..b543288369ab 100644 --- a/DiscoveryEngine/src/V1beta/RecommendResponse/RecommendationResult.php +++ b/DiscoveryEngine/src/V1beta/RecommendResponse/RecommendationResult.php @@ -30,7 +30,7 @@ class RecommendationResult extends \Google\Protobuf\Internal\Message */ protected $document = null; /** - * Additional Document metadata / annotations. + * Additional Document metadata or annotations. * Possible values: * * `score`: Recommendation score in double value. Is set if * `returnScore` is set to true in @@ -52,7 +52,7 @@ class RecommendationResult extends \Google\Protobuf\Internal\Message * Set if `returnDocument` is set to true in * [RecommendRequest.params][google.cloud.discoveryengine.v1beta.RecommendRequest.params]. * @type array|\Google\Protobuf\Internal\MapField $metadata - * Additional Document metadata / annotations. + * Additional Document metadata or annotations. * Possible values: * * `score`: Recommendation score in double value. Is set if * `returnScore` is set to true in @@ -129,7 +129,7 @@ public function setDocument($var) } /** - * Additional Document metadata / annotations. + * Additional Document metadata or annotations. * Possible values: * * `score`: Recommendation score in double value. Is set if * `returnScore` is set to true in @@ -144,7 +144,7 @@ public function getMetadata() } /** - * Additional Document metadata / annotations. + * Additional Document metadata or annotations. * Possible values: * * `score`: Recommendation score in double value. Is set if * `returnScore` is set to true in diff --git a/DiscoveryEngine/src/V1beta/SearchRequest.php b/DiscoveryEngine/src/V1beta/SearchRequest.php index b2f9b1b1acc3..e7283f2c198b 100644 --- a/DiscoveryEngine/src/V1beta/SearchRequest.php +++ b/DiscoveryEngine/src/V1beta/SearchRequest.php @@ -86,7 +86,10 @@ class SearchRequest extends \Google\Protobuf\Internal\Message */ protected $offset = 0; /** - * A list of data store specs to apply on a search call. + * Specs defining dataStores to filter on in a search call and configurations + * for those dataStores. This is only considered for engines with multiple + * dataStores use case. For single dataStore within an engine, they should + * use the specs at the top level. * * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchRequest.DataStoreSpec data_store_specs = 32; */ @@ -127,7 +130,8 @@ class SearchRequest extends \Google\Protobuf\Internal\Message * The order in which documents are returned. Documents can be ordered by * a field in an [Document][google.cloud.discoveryengine.v1beta.Document] * object. Leave it unset if ordered by relevance. `order_by` expression is - * case-sensitive. For more information on ordering, see + * case-sensitive. + * For more information on ordering for retail search, see * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. * @@ -154,7 +158,7 @@ class SearchRequest extends \Google\Protobuf\Internal\Message /** * Boost specification to boost certain documents. * For more information on boosting, see - * [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results) * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.SearchRequest.BoostSpec boost_spec = 10; */ @@ -164,15 +168,13 @@ class SearchRequest extends \Google\Protobuf\Internal\Message * For public website search only, supported values are: * * `user_country_code`: string. Default empty. If set to non-empty, results * are restricted or boosted based on the location provided. - * Example: - * user_country_code: "au" + * For example, `user_country_code: "au"` * For available codes see [Country * Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) * * `search_type`: double. Default empty. Enables non-webpage searching * depending on the value. The only valid non-default value is 1, * which enables image searching. - * Example: - * search_type: 1 + * For example, `search_type: 1` * * Generated from protobuf field map params = 11; */ @@ -326,7 +328,10 @@ class SearchRequest extends \Google\Protobuf\Internal\Message * is unset. * If this field is negative, an `INVALID_ARGUMENT` is returned. * @type array<\Google\Cloud\DiscoveryEngine\V1beta\SearchRequest\DataStoreSpec>|\Google\Protobuf\Internal\RepeatedField $data_store_specs - * A list of data store specs to apply on a search call. + * Specs defining dataStores to filter on in a search call and configurations + * for those dataStores. This is only considered for engines with multiple + * dataStores use case. For single dataStore within an engine, they should + * use the specs at the top level. * @type string $filter * The filter syntax consists of an expression language for constructing a * predicate from one or more fields of the documents being filtered. Filter @@ -355,7 +360,8 @@ class SearchRequest extends \Google\Protobuf\Internal\Message * The order in which documents are returned. Documents can be ordered by * a field in an [Document][google.cloud.discoveryengine.v1beta.Document] * object. Leave it unset if ordered by relevance. `order_by` expression is - * case-sensitive. For more information on ordering, see + * case-sensitive. + * For more information on ordering for retail search, see * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. * @type \Google\Cloud\DiscoveryEngine\V1beta\UserInfo $user_info @@ -370,21 +376,19 @@ class SearchRequest extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\DiscoveryEngine\V1beta\SearchRequest\BoostSpec $boost_spec * Boost specification to boost certain documents. * For more information on boosting, see - * [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results) * @type array|\Google\Protobuf\Internal\MapField $params * Additional search parameters. * For public website search only, supported values are: * * `user_country_code`: string. Default empty. If set to non-empty, results * are restricted or boosted based on the location provided. - * Example: - * user_country_code: "au" + * For example, `user_country_code: "au"` * For available codes see [Country * Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) * * `search_type`: double. Default empty. Enables non-webpage searching * depending on the value. The only valid non-default value is 1, * which enables image searching. - * Example: - * search_type: 1 + * For example, `search_type: 1` * @type \Google\Cloud\DiscoveryEngine\V1beta\SearchRequest\QueryExpansionSpec $query_expansion_spec * The query expansion specification that specifies the conditions under which * query expansion occurs. @@ -706,7 +710,10 @@ public function setOffset($var) } /** - * A list of data store specs to apply on a search call. + * Specs defining dataStores to filter on in a search call and configurations + * for those dataStores. This is only considered for engines with multiple + * dataStores use case. For single dataStore within an engine, they should + * use the specs at the top level. * * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchRequest.DataStoreSpec data_store_specs = 32; * @return \Google\Protobuf\Internal\RepeatedField @@ -717,7 +724,10 @@ public function getDataStoreSpecs() } /** - * A list of data store specs to apply on a search call. + * Specs defining dataStores to filter on in a search call and configurations + * for those dataStores. This is only considered for engines with multiple + * dataStores use case. For single dataStore within an engine, they should + * use the specs at the top level. * * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchRequest.DataStoreSpec data_store_specs = 32; * @param array<\Google\Cloud\DiscoveryEngine\V1beta\SearchRequest\DataStoreSpec>|\Google\Protobuf\Internal\RepeatedField $var @@ -827,7 +837,8 @@ public function setCanonicalFilter($var) * The order in which documents are returned. Documents can be ordered by * a field in an [Document][google.cloud.discoveryengine.v1beta.Document] * object. Leave it unset if ordered by relevance. `order_by` expression is - * case-sensitive. For more information on ordering, see + * case-sensitive. + * For more information on ordering for retail search, see * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. * @@ -843,7 +854,8 @@ public function getOrderBy() * The order in which documents are returned. Documents can be ordered by * a field in an [Document][google.cloud.discoveryengine.v1beta.Document] * object. Leave it unset if ordered by relevance. `order_by` expression is - * case-sensitive. For more information on ordering, see + * case-sensitive. + * For more information on ordering for retail search, see * [Ordering](https://cloud.google.com/retail/docs/filter-and-order#order) * If this field is unrecognizable, an `INVALID_ARGUMENT` is returned. * @@ -934,7 +946,7 @@ public function setFacetSpecs($var) /** * Boost specification to boost certain documents. * For more information on boosting, see - * [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results) * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.SearchRequest.BoostSpec boost_spec = 10; * @return \Google\Cloud\DiscoveryEngine\V1beta\SearchRequest\BoostSpec|null @@ -957,7 +969,7 @@ public function clearBoostSpec() /** * Boost specification to boost certain documents. * For more information on boosting, see - * [Boosting](https://cloud.google.com/retail/docs/boosting#boost) + * [Boosting](https://cloud.google.com/generative-ai-app-builder/docs/boost-search-results) * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.SearchRequest.BoostSpec boost_spec = 10; * @param \Google\Cloud\DiscoveryEngine\V1beta\SearchRequest\BoostSpec $var @@ -976,15 +988,13 @@ public function setBoostSpec($var) * For public website search only, supported values are: * * `user_country_code`: string. Default empty. If set to non-empty, results * are restricted or boosted based on the location provided. - * Example: - * user_country_code: "au" + * For example, `user_country_code: "au"` * For available codes see [Country * Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) * * `search_type`: double. Default empty. Enables non-webpage searching * depending on the value. The only valid non-default value is 1, * which enables image searching. - * Example: - * search_type: 1 + * For example, `search_type: 1` * * Generated from protobuf field map params = 11; * @return \Google\Protobuf\Internal\MapField @@ -999,15 +1009,13 @@ public function getParams() * For public website search only, supported values are: * * `user_country_code`: string. Default empty. If set to non-empty, results * are restricted or boosted based on the location provided. - * Example: - * user_country_code: "au" + * For example, `user_country_code: "au"` * For available codes see [Country * Codes](https://developers.google.com/custom-search/docs/json_api_reference#countryCodes) * * `search_type`: double. Default empty. Enables non-webpage searching * depending on the value. The only valid non-default value is 1, * which enables image searching. - * Example: - * search_type: 1 + * For example, `search_type: 1` * * Generated from protobuf field map params = 11; * @param array|\Google\Protobuf\Internal\MapField $var diff --git a/DiscoveryEngine/src/V1beta/SearchRequest/BoostSpec/ConditionBoostSpec/BoostControlSpec/AttributeType.php b/DiscoveryEngine/src/V1beta/SearchRequest/BoostSpec/ConditionBoostSpec/BoostControlSpec/AttributeType.php index c42c8cf684b8..c2d9fedd1e00 100644 --- a/DiscoveryEngine/src/V1beta/SearchRequest/BoostSpec/ConditionBoostSpec/BoostControlSpec/AttributeType.php +++ b/DiscoveryEngine/src/V1beta/SearchRequest/BoostSpec/ConditionBoostSpec/BoostControlSpec/AttributeType.php @@ -35,7 +35,7 @@ class AttributeType * specified. The value must be formatted as an XSD `dayTimeDuration` * value (a restricted subset of an ISO 8601 duration value). The * pattern for this is: `[nD][T[nH][nM][nS]]`. - * E.g. `5D`, `3DT12H30M`, `T24H`. + * For example, `5D`, `3DT12H30M`, `T24H`. * * Generated from protobuf enum FRESHNESS = 2; */ diff --git a/DiscoveryEngine/src/V1beta/SearchRequest/ContentSearchSpec/SummarySpec.php b/DiscoveryEngine/src/V1beta/SearchRequest/ContentSearchSpec/SummarySpec.php index dab93e47d9a9..8f0ea5c1237d 100644 --- a/DiscoveryEngine/src/V1beta/SearchRequest/ContentSearchSpec/SummarySpec.php +++ b/DiscoveryEngine/src/V1beta/SearchRequest/ContentSearchSpec/SummarySpec.php @@ -20,7 +20,10 @@ class SummarySpec extends \Google\Protobuf\Internal\Message * The number of top results to generate the summary from. If the number * of results returned is less than `summaryResultCount`, the summary is * generated from all of the results. - * At most 10 results can be used to generate a summary. + * At most 10 results for documents mode, or 50 for chunks mode, can be + * used to generate a summary. The chunks mode is used when + * [SearchRequest.ContentSearchSpec.search_result_mode][] is set to + * [CHUNKS][SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS]. * * Generated from protobuf field int32 summary_result_count = 1; */ @@ -116,7 +119,10 @@ class SummarySpec extends \Google\Protobuf\Internal\Message * The number of top results to generate the summary from. If the number * of results returned is less than `summaryResultCount`, the summary is * generated from all of the results. - * At most 10 results can be used to generate a summary. + * At most 10 results for documents mode, or 50 for chunks mode, can be + * used to generate a summary. The chunks mode is used when + * [SearchRequest.ContentSearchSpec.search_result_mode][] is set to + * [CHUNKS][SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS]. * @type bool $include_citations * Specifies whether to include citations in the summary. The default * value is `false`. @@ -180,7 +186,10 @@ public function __construct($data = NULL) { * The number of top results to generate the summary from. If the number * of results returned is less than `summaryResultCount`, the summary is * generated from all of the results. - * At most 10 results can be used to generate a summary. + * At most 10 results for documents mode, or 50 for chunks mode, can be + * used to generate a summary. The chunks mode is used when + * [SearchRequest.ContentSearchSpec.search_result_mode][] is set to + * [CHUNKS][SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS]. * * Generated from protobuf field int32 summary_result_count = 1; * @return int @@ -194,7 +203,10 @@ public function getSummaryResultCount() * The number of top results to generate the summary from. If the number * of results returned is less than `summaryResultCount`, the summary is * generated from all of the results. - * At most 10 results can be used to generate a summary. + * At most 10 results for documents mode, or 50 for chunks mode, can be + * used to generate a summary. The chunks mode is used when + * [SearchRequest.ContentSearchSpec.search_result_mode][] is set to + * [CHUNKS][SearchRequest.ContentSearchSpec.SearchResultMode.CHUNKS]. * * Generated from protobuf field int32 summary_result_count = 1; * @param int $var diff --git a/DiscoveryEngine/src/V1beta/SearchRequest/DataStoreSpec.php b/DiscoveryEngine/src/V1beta/SearchRequest/DataStoreSpec.php index fb6997a48612..7682110a1012 100644 --- a/DiscoveryEngine/src/V1beta/SearchRequest/DataStoreSpec.php +++ b/DiscoveryEngine/src/V1beta/SearchRequest/DataStoreSpec.php @@ -9,7 +9,9 @@ use Google\Protobuf\Internal\GPBUtil; /** - * A struct to define data stores to filter on in a search call. + * A struct to define data stores to filter on in a search call and + * configurations for those data stores. A maximum of 1 DataStoreSpec per + * data_store is allowed. Otherwise, an `INVALID_ARGUMENT` error is returned. * * Generated from protobuf message google.cloud.discoveryengine.v1beta.SearchRequest.DataStoreSpec */ diff --git a/DiscoveryEngine/src/V1beta/SearchRequest/FacetSpec.php b/DiscoveryEngine/src/V1beta/SearchRequest/FacetSpec.php index b9bccac24e5e..8f4043868e2e 100644 --- a/DiscoveryEngine/src/V1beta/SearchRequest/FacetSpec.php +++ b/DiscoveryEngine/src/V1beta/SearchRequest/FacetSpec.php @@ -22,7 +22,7 @@ class FacetSpec extends \Google\Protobuf\Internal\Message */ protected $facet_key = null; /** - * Maximum of facet values that should be returned for this facet. If + * Maximum facet values that are returned for this facet. If * unspecified, defaults to 20. The maximum allowed value is 300. Values * above 300 are coerced to 300. * If this field is negative, an `INVALID_ARGUMENT` is returned. @@ -94,7 +94,7 @@ class FacetSpec extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\DiscoveryEngine\V1beta\SearchRequest\FacetSpec\FacetKey $facet_key * Required. The facet key specification. * @type int $limit - * Maximum of facet values that should be returned for this facet. If + * Maximum facet values that are returned for this facet. If * unspecified, defaults to 20. The maximum allowed value is 300. Values * above 300 are coerced to 300. * If this field is negative, an `INVALID_ARGUMENT` is returned. @@ -188,7 +188,7 @@ public function setFacetKey($var) } /** - * Maximum of facet values that should be returned for this facet. If + * Maximum facet values that are returned for this facet. If * unspecified, defaults to 20. The maximum allowed value is 300. Values * above 300 are coerced to 300. * If this field is negative, an `INVALID_ARGUMENT` is returned. @@ -202,7 +202,7 @@ public function getLimit() } /** - * Maximum of facet values that should be returned for this facet. If + * Maximum facet values that are returned for this facet. If * unspecified, defaults to 20. The maximum allowed value is 300. Values * above 300 are coerced to 300. * If this field is negative, an `INVALID_ARGUMENT` is returned. diff --git a/DiscoveryEngine/src/V1beta/SearchRequest/FacetSpec/FacetKey.php b/DiscoveryEngine/src/V1beta/SearchRequest/FacetSpec/FacetKey.php index 2c22cd2d327a..cf19c735df27 100644 --- a/DiscoveryEngine/src/V1beta/SearchRequest/FacetSpec/FacetKey.php +++ b/DiscoveryEngine/src/V1beta/SearchRequest/FacetSpec/FacetKey.php @@ -53,7 +53,7 @@ class FacetKey extends \Google\Protobuf\Internal\Message */ private $prefixes; /** - * Only get facet values that contains the given strings. For example, + * Only get facet values that contain the given strings. For example, * suppose "category" has three values "Action > 2022", * "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the * "category" facet only contains "Action > 2022" and "Sci-Fi > 2022". @@ -116,7 +116,7 @@ class FacetKey extends \Google\Protobuf\Internal\Message * "category" facet only contains "Action > 2022" and "Action > 2021". * Only supported on textual fields. Maximum is 10. * @type array|\Google\Protobuf\Internal\RepeatedField $contains - * Only get facet values that contains the given strings. For example, + * Only get facet values that contain the given strings. For example, * suppose "category" has three values "Action > 2022", * "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the * "category" facet only contains "Action > 2022" and "Sci-Fi > 2022". @@ -276,7 +276,7 @@ public function setPrefixes($var) } /** - * Only get facet values that contains the given strings. For example, + * Only get facet values that contain the given strings. For example, * suppose "category" has three values "Action > 2022", * "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the * "category" facet only contains "Action > 2022" and "Sci-Fi > 2022". @@ -291,7 +291,7 @@ public function getContains() } /** - * Only get facet values that contains the given strings. For example, + * Only get facet values that contain the given strings. For example, * suppose "category" has three values "Action > 2022", * "Action > 2021" and "Sci-Fi > 2022". If set "contains" to "2022", the * "category" facet only contains "Action > 2022" and "Sci-Fi > 2022". diff --git a/DiscoveryEngine/src/V1beta/SearchRequest/SpellCorrectionSpec.php b/DiscoveryEngine/src/V1beta/SearchRequest/SpellCorrectionSpec.php index a9d063e6f598..2fe848a052b7 100644 --- a/DiscoveryEngine/src/V1beta/SearchRequest/SpellCorrectionSpec.php +++ b/DiscoveryEngine/src/V1beta/SearchRequest/SpellCorrectionSpec.php @@ -16,8 +16,8 @@ class SpellCorrectionSpec extends \Google\Protobuf\Internal\Message { /** - * The mode under which spell correction should take effect to - * replace the original search query. Default to + * The mode under which spell correction + * replaces the original search query. Defaults to * [Mode.AUTO][google.cloud.discoveryengine.v1beta.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.SearchRequest.SpellCorrectionSpec.Mode mode = 1; @@ -31,8 +31,8 @@ class SpellCorrectionSpec extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type int $mode - * The mode under which spell correction should take effect to - * replace the original search query. Default to + * The mode under which spell correction + * replaces the original search query. Defaults to * [Mode.AUTO][google.cloud.discoveryengine.v1beta.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. * } */ @@ -42,8 +42,8 @@ public function __construct($data = NULL) { } /** - * The mode under which spell correction should take effect to - * replace the original search query. Default to + * The mode under which spell correction + * replaces the original search query. Defaults to * [Mode.AUTO][google.cloud.discoveryengine.v1beta.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.SearchRequest.SpellCorrectionSpec.Mode mode = 1; @@ -55,8 +55,8 @@ public function getMode() } /** - * The mode under which spell correction should take effect to - * replace the original search query. Default to + * The mode under which spell correction + * replaces the original search query. Defaults to * [Mode.AUTO][google.cloud.discoveryengine.v1beta.SearchRequest.SpellCorrectionSpec.Mode.AUTO]. * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.SearchRequest.SpellCorrectionSpec.Mode mode = 1; diff --git a/DiscoveryEngine/src/V1beta/SearchRequest/SpellCorrectionSpec/Mode.php b/DiscoveryEngine/src/V1beta/SearchRequest/SpellCorrectionSpec/Mode.php index 8297f114d490..b88e38c01d0b 100644 --- a/DiscoveryEngine/src/V1beta/SearchRequest/SpellCorrectionSpec/Mode.php +++ b/DiscoveryEngine/src/V1beta/SearchRequest/SpellCorrectionSpec/Mode.php @@ -22,10 +22,10 @@ class Mode */ const MODE_UNSPECIFIED = 0; /** - * Search API will try to find a spell suggestion if there - * is any and put in the + * Search API tries to find a spelling suggestion. If a suggestion is + * found, it is put in the * [SearchResponse.corrected_query][google.cloud.discoveryengine.v1beta.SearchResponse.corrected_query]. - * The spell suggestion will not be used as the search query. + * The spelling suggestion won't be used as the search query. * * Generated from protobuf enum SUGGESTION_ONLY = 1; */ diff --git a/DiscoveryEngine/src/V1beta/SearchResponse.php b/DiscoveryEngine/src/V1beta/SearchResponse.php index 1e67a1346e68..f8f96066b7f7 100644 --- a/DiscoveryEngine/src/V1beta/SearchResponse.php +++ b/DiscoveryEngine/src/V1beta/SearchResponse.php @@ -99,9 +99,6 @@ class SearchResponse extends \Google\Protobuf\Internal\Message */ private $applied_controls; /** - * Debug information specifically related to forward geocoding issues arising - * from Geolocation Search. - * * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchResponse.GeoSearchDebugInfo geo_search_debug_info = 16; */ private $geo_search_debug_info; @@ -160,8 +157,6 @@ class SearchResponse extends \Google\Protobuf\Internal\Message * @type array|\Google\Protobuf\Internal\RepeatedField $applied_controls * Controls applied as part of the Control service. * @type array<\Google\Cloud\DiscoveryEngine\V1beta\SearchResponse\GeoSearchDebugInfo>|\Google\Protobuf\Internal\RepeatedField $geo_search_debug_info - * Debug information specifically related to forward geocoding issues arising - * from Geolocation Search. * @type \Google\Cloud\DiscoveryEngine\V1beta\SearchResponse\QueryExpansionInfo $query_expansion_info * Query expansion information for the returned results. * } @@ -494,9 +489,6 @@ public function setAppliedControls($var) } /** - * Debug information specifically related to forward geocoding issues arising - * from Geolocation Search. - * * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchResponse.GeoSearchDebugInfo geo_search_debug_info = 16; * @return \Google\Protobuf\Internal\RepeatedField */ @@ -506,9 +498,6 @@ public function getGeoSearchDebugInfo() } /** - * Debug information specifically related to forward geocoding issues arising - * from Geolocation Search. - * * Generated from protobuf field repeated .google.cloud.discoveryengine.v1beta.SearchResponse.GeoSearchDebugInfo geo_search_debug_info = 16; * @param array<\Google\Cloud\DiscoveryEngine\V1beta\SearchResponse\GeoSearchDebugInfo>|\Google\Protobuf\Internal\RepeatedField $var * @return $this diff --git a/DiscoveryEngine/src/V1beta/SearchResponse/Facet.php b/DiscoveryEngine/src/V1beta/SearchResponse/Facet.php index ec096c76d86f..9b549fb22fdc 100644 --- a/DiscoveryEngine/src/V1beta/SearchResponse/Facet.php +++ b/DiscoveryEngine/src/V1beta/SearchResponse/Facet.php @@ -16,7 +16,7 @@ class Facet extends \Google\Protobuf\Internal\Message { /** - * The key for this facet. E.g., "colors" or "price". It matches + * The key for this facet. For example, `"colors"` or `"price"`. It matches * [SearchRequest.FacetSpec.FacetKey.key][google.cloud.discoveryengine.v1beta.SearchRequest.FacetSpec.FacetKey.key]. * * Generated from protobuf field string key = 1; @@ -42,7 +42,7 @@ class Facet extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $key - * The key for this facet. E.g., "colors" or "price". It matches + * The key for this facet. For example, `"colors"` or `"price"`. It matches * [SearchRequest.FacetSpec.FacetKey.key][google.cloud.discoveryengine.v1beta.SearchRequest.FacetSpec.FacetKey.key]. * @type array<\Google\Cloud\DiscoveryEngine\V1beta\SearchResponse\Facet\FacetValue>|\Google\Protobuf\Internal\RepeatedField $values * The facet values for this field. @@ -56,7 +56,7 @@ public function __construct($data = NULL) { } /** - * The key for this facet. E.g., "colors" or "price". It matches + * The key for this facet. For example, `"colors"` or `"price"`. It matches * [SearchRequest.FacetSpec.FacetKey.key][google.cloud.discoveryengine.v1beta.SearchRequest.FacetSpec.FacetKey.key]. * * Generated from protobuf field string key = 1; @@ -68,7 +68,7 @@ public function getKey() } /** - * The key for this facet. E.g., "colors" or "price". It matches + * The key for this facet. For example, `"colors"` or `"price"`. It matches * [SearchRequest.FacetSpec.FacetKey.key][google.cloud.discoveryengine.v1beta.SearchRequest.FacetSpec.FacetKey.key]. * * Generated from protobuf field string key = 1; diff --git a/DiscoveryEngine/src/V1beta/SearchResponse/GuidedSearchResult/RefinementAttribute.php b/DiscoveryEngine/src/V1beta/SearchResponse/GuidedSearchResult/RefinementAttribute.php index ae150056ed8c..53bd506300eb 100644 --- a/DiscoveryEngine/src/V1beta/SearchResponse/GuidedSearchResult/RefinementAttribute.php +++ b/DiscoveryEngine/src/V1beta/SearchResponse/GuidedSearchResult/RefinementAttribute.php @@ -16,13 +16,13 @@ class RefinementAttribute extends \Google\Protobuf\Internal\Message { /** - * Attribute key used to refine the results e.g. 'movie_type'. + * Attribute key used to refine the results. For example, `"movie_type"`. * * Generated from protobuf field string attribute_key = 1; */ protected $attribute_key = ''; /** - * Attribute value used to refine the results e.g. 'drama'. + * Attribute value used to refine the results. For example, `"drama"`. * * Generated from protobuf field string attribute_value = 2; */ @@ -35,9 +35,9 @@ class RefinementAttribute extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $attribute_key - * Attribute key used to refine the results e.g. 'movie_type'. + * Attribute key used to refine the results. For example, `"movie_type"`. * @type string $attribute_value - * Attribute value used to refine the results e.g. 'drama'. + * Attribute value used to refine the results. For example, `"drama"`. * } */ public function __construct($data = NULL) { @@ -46,7 +46,7 @@ public function __construct($data = NULL) { } /** - * Attribute key used to refine the results e.g. 'movie_type'. + * Attribute key used to refine the results. For example, `"movie_type"`. * * Generated from protobuf field string attribute_key = 1; * @return string @@ -57,7 +57,7 @@ public function getAttributeKey() } /** - * Attribute key used to refine the results e.g. 'movie_type'. + * Attribute key used to refine the results. For example, `"movie_type"`. * * Generated from protobuf field string attribute_key = 1; * @param string $var @@ -72,7 +72,7 @@ public function setAttributeKey($var) } /** - * Attribute value used to refine the results e.g. 'drama'. + * Attribute value used to refine the results. For example, `"drama"`. * * Generated from protobuf field string attribute_value = 2; * @return string @@ -83,7 +83,7 @@ public function getAttributeValue() } /** - * Attribute value used to refine the results e.g. 'drama'. + * Attribute value used to refine the results. For example, `"drama"`. * * Generated from protobuf field string attribute_value = 2; * @param string $var diff --git a/DiscoveryEngine/src/V1beta/SearchResponse/SearchResult.php b/DiscoveryEngine/src/V1beta/SearchResponse/SearchResult.php index 219a3c173c54..44d3bffb514e 100644 --- a/DiscoveryEngine/src/V1beta/SearchResponse/SearchResult.php +++ b/DiscoveryEngine/src/V1beta/SearchResponse/SearchResult.php @@ -24,7 +24,7 @@ class SearchResult extends \Google\Protobuf\Internal\Message protected $id = ''; /** * The document data snippet in the search response. Only fields that are - * marked as retrievable are populated. + * marked as `retrievable` are populated. * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Document document = 2; */ @@ -47,7 +47,7 @@ class SearchResult extends \Google\Protobuf\Internal\Message * searched [Document][google.cloud.discoveryengine.v1beta.Document]. * @type \Google\Cloud\DiscoveryEngine\V1beta\Document $document * The document data snippet in the search response. Only fields that are - * marked as retrievable are populated. + * marked as `retrievable` are populated. * @type array|\Google\Protobuf\Internal\MapField $model_scores * Google provided available scores. * } @@ -87,7 +87,7 @@ public function setId($var) /** * The document data snippet in the search response. Only fields that are - * marked as retrievable are populated. + * marked as `retrievable` are populated. * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Document document = 2; * @return \Google\Cloud\DiscoveryEngine\V1beta\Document|null @@ -109,7 +109,7 @@ public function clearDocument() /** * The document data snippet in the search response. Only fields that are - * marked as retrievable are populated. + * marked as `retrievable` are populated. * * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Document document = 2; * @param \Google\Cloud\DiscoveryEngine\V1beta\Document $var diff --git a/DiscoveryEngine/src/V1beta/SearchResponse/Summary.php b/DiscoveryEngine/src/V1beta/SearchResponse/Summary.php index 9d0ae92747f6..0865287791cf 100644 --- a/DiscoveryEngine/src/V1beta/SearchResponse/Summary.php +++ b/DiscoveryEngine/src/V1beta/SearchResponse/Summary.php @@ -9,7 +9,7 @@ use Google\Protobuf\Internal\GPBUtil; /** - * Summary of the top N search result specified by the summary spec. + * Summary of the top N search results specified by the summary spec. * * Generated from protobuf message google.cloud.discoveryengine.v1beta.SearchResponse.Summary */ diff --git a/DiscoveryEngine/src/V1beta/SearchUseCase.php b/DiscoveryEngine/src/V1beta/SearchUseCase.php new file mode 100644 index 000000000000..9a48affbe322 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/SearchUseCase.php @@ -0,0 +1,65 @@ +google.cloud.discoveryengine.v1beta.SearchUseCase + */ +class SearchUseCase +{ + /** + * Value used when unset. Will not occur in CSS. + * + * Generated from protobuf enum SEARCH_USE_CASE_UNSPECIFIED = 0; + */ + const SEARCH_USE_CASE_UNSPECIFIED = 0; + /** + * Search use case. Expects the traffic has a non-empty + * [query][google.cloud.discoveryengine.v1beta.SearchRequest.query]. + * + * Generated from protobuf enum SEARCH_USE_CASE_SEARCH = 1; + */ + const SEARCH_USE_CASE_SEARCH = 1; + /** + * Browse use case. Expects the traffic has an empty + * [query][google.cloud.discoveryengine.v1beta.SearchRequest.query]. + * + * Generated from protobuf enum SEARCH_USE_CASE_BROWSE = 2; + */ + const SEARCH_USE_CASE_BROWSE = 2; + + private static $valueToName = [ + self::SEARCH_USE_CASE_UNSPECIFIED => 'SEARCH_USE_CASE_UNSPECIFIED', + self::SEARCH_USE_CASE_SEARCH => 'SEARCH_USE_CASE_SEARCH', + self::SEARCH_USE_CASE_BROWSE => 'SEARCH_USE_CASE_BROWSE', + ]; + + public static function name($value) + { + if (!isset(self::$valueToName[$value])) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no name defined for value %s', __CLASS__, $value)); + } + return self::$valueToName[$value]; + } + + + public static function value($name) + { + $const = __CLASS__ . '::' . strtoupper($name); + if (!defined($const)) { + throw new UnexpectedValueException(sprintf( + 'Enum %s has no value defined for name %s', __CLASS__, $name)); + } + return constant($const); + } +} + diff --git a/DiscoveryEngine/src/V1beta/Session.php b/DiscoveryEngine/src/V1beta/Session.php index df40eb9f8f52..215efdc8a2a8 100644 --- a/DiscoveryEngine/src/V1beta/Session.php +++ b/DiscoveryEngine/src/V1beta/Session.php @@ -17,7 +17,7 @@ class Session extends \Google\Protobuf\Internal\Message { /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/engines/{engine}/sessions/*` + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; */ @@ -61,7 +61,7 @@ class Session extends \Google\Protobuf\Internal\Message * * @type string $name * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/engines/{engine}/sessions/*` + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*` * @type int $state * The state of the session. * @type string $user_pseudo_id @@ -81,7 +81,7 @@ public function __construct($data = NULL) { /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/engines/{engine}/sessions/*` + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * @return string @@ -93,7 +93,7 @@ public function getName() /** * Immutable. Fully qualified name - * `project/*/locations/global/collections/{collection}/engines/{engine}/sessions/*` + * `projects/{project}/locations/global/collections/{collection}/engines/{engine}/sessions/*` * * Generated from protobuf field string name = 1 [(.google.api.field_behavior) = IMMUTABLE]; * @param string $var diff --git a/DiscoveryEngine/src/V1beta/Session/Turn.php b/DiscoveryEngine/src/V1beta/Session/Turn.php index 7cbb8b7cc0e3..fad44e96167a 100644 --- a/DiscoveryEngine/src/V1beta/Session/Turn.php +++ b/DiscoveryEngine/src/V1beta/Session/Turn.php @@ -24,6 +24,8 @@ class Turn extends \Google\Protobuf\Internal\Message protected $query = null; /** * The resource name of the answer to the user query. + * Only set if the answer generation (/answer API call) happened in this + * turn. * * Generated from protobuf field string answer = 2 [(.google.api.resource_reference) = { */ @@ -39,6 +41,8 @@ class Turn extends \Google\Protobuf\Internal\Message * The user query. * @type string $answer * The resource name of the answer to the user query. + * Only set if the answer generation (/answer API call) happened in this + * turn. * } */ public function __construct($data = NULL) { @@ -84,6 +88,8 @@ public function setQuery($var) /** * The resource name of the answer to the user query. + * Only set if the answer generation (/answer API call) happened in this + * turn. * * Generated from protobuf field string answer = 2 [(.google.api.resource_reference) = { * @return string @@ -95,6 +101,8 @@ public function getAnswer() /** * The resource name of the answer to the user query. + * Only set if the answer generation (/answer API call) happened in this + * turn. * * Generated from protobuf field string answer = 2 [(.google.api.resource_reference) = { * @param string $var diff --git a/DiscoveryEngine/src/V1beta/TargetSite.php b/DiscoveryEngine/src/V1beta/TargetSite.php index 0a00be7eaf55..f3888b6e71a1 100644 --- a/DiscoveryEngine/src/V1beta/TargetSite.php +++ b/DiscoveryEngine/src/V1beta/TargetSite.php @@ -54,6 +54,12 @@ class TargetSite extends \Google\Protobuf\Internal\Message * Generated from protobuf field string generated_uri_pattern = 4 [(.google.api.field_behavior) = OUTPUT_ONLY]; */ protected $generated_uri_pattern = ''; + /** + * Output only. Root domain of the provided_uri_pattern. + * + * Generated from protobuf field string root_domain_uri = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + */ + protected $root_domain_uri = ''; /** * Output only. Site ownership and validity verification status. * @@ -104,6 +110,8 @@ class TargetSite extends \Google\Protobuf\Internal\Message * generate the URI pattern to be used by the search engine. * @type string $generated_uri_pattern * Output only. This is system-generated based on the provided_uri_pattern. + * @type string $root_domain_uri + * Output only. Root domain of the provided_uri_pattern. * @type \Google\Cloud\DiscoveryEngine\V1beta\SiteVerificationInfo $site_verification_info * Output only. Site ownership and validity verification status. * @type int $indexing_status @@ -267,6 +275,32 @@ public function setGeneratedUriPattern($var) return $this; } + /** + * Output only. Root domain of the provided_uri_pattern. + * + * Generated from protobuf field string root_domain_uri = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @return string + */ + public function getRootDomainUri() + { + return $this->root_domain_uri; + } + + /** + * Output only. Root domain of the provided_uri_pattern. + * + * Generated from protobuf field string root_domain_uri = 10 [(.google.api.field_behavior) = OUTPUT_ONLY]; + * @param string $var + * @return $this + */ + public function setRootDomainUri($var) + { + GPBUtil::checkString($var, True); + $this->root_domain_uri = $var; + + return $this; + } + /** * Output only. Site ownership and validity verification status. * diff --git a/DiscoveryEngine/src/V1beta/TrainCustomModelRequest.php b/DiscoveryEngine/src/V1beta/TrainCustomModelRequest.php index 1280b7c8d19d..df170efde63a 100644 --- a/DiscoveryEngine/src/V1beta/TrainCustomModelRequest.php +++ b/DiscoveryEngine/src/V1beta/TrainCustomModelRequest.php @@ -39,6 +39,12 @@ class TrainCustomModelRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field .google.cloud.discoveryengine.v1beta.ImportErrorConfig error_config = 4; */ protected $error_config = null; + /** + * If not provided, a UUID will be generated. + * + * Generated from protobuf field string model_id = 5; + */ + protected $model_id = ''; protected $training_input; /** @@ -59,6 +65,8 @@ class TrainCustomModelRequest extends \Google\Protobuf\Internal\Message * @type \Google\Cloud\DiscoveryEngine\V1beta\ImportErrorConfig $error_config * The desired location of errors incurred during the data ingestion and * training. + * @type string $model_id + * If not provided, a UUID will be generated. * } */ public function __construct($data = NULL) { @@ -193,6 +201,32 @@ public function setErrorConfig($var) return $this; } + /** + * If not provided, a UUID will be generated. + * + * Generated from protobuf field string model_id = 5; + * @return string + */ + public function getModelId() + { + return $this->model_id; + } + + /** + * If not provided, a UUID will be generated. + * + * Generated from protobuf field string model_id = 5; + * @param string $var + * @return $this + */ + public function setModelId($var) + { + GPBUtil::checkString($var, True); + $this->model_id = $var; + + return $this; + } + /** * @return string */ diff --git a/DiscoveryEngine/src/V1beta/TrainCustomModelResponse.php b/DiscoveryEngine/src/V1beta/TrainCustomModelResponse.php index fa87d6899ca2..aad2ff8a5bb6 100644 --- a/DiscoveryEngine/src/V1beta/TrainCustomModelResponse.php +++ b/DiscoveryEngine/src/V1beta/TrainCustomModelResponse.php @@ -48,6 +48,12 @@ class TrainCustomModelResponse extends \Google\Protobuf\Internal\Message * Generated from protobuf field map metrics = 4; */ private $metrics; + /** + * Fully qualified name of the CustomTuningModel. + * + * Generated from protobuf field string model_name = 5; + */ + protected $model_name = ''; /** * Constructor. @@ -70,6 +76,8 @@ class TrainCustomModelResponse extends \Google\Protobuf\Internal\Message * * **ready**: The model is ready for serving. * @type array|\Google\Protobuf\Internal\MapField $metrics * The metrics of the trained model. + * @type string $model_name + * Fully qualified name of the CustomTuningModel. * } */ public function __construct($data = NULL) { @@ -205,5 +213,31 @@ public function setMetrics($var) return $this; } + /** + * Fully qualified name of the CustomTuningModel. + * + * Generated from protobuf field string model_name = 5; + * @return string + */ + public function getModelName() + { + return $this->model_name; + } + + /** + * Fully qualified name of the CustomTuningModel. + * + * Generated from protobuf field string model_name = 5; + * @param string $var + * @return $this + */ + public function setModelName($var) + { + GPBUtil::checkString($var, True); + $this->model_name = $var; + + return $this; + } + } diff --git a/DiscoveryEngine/src/V1beta/UpdateControlRequest.php b/DiscoveryEngine/src/V1beta/UpdateControlRequest.php new file mode 100644 index 000000000000..745d5555b539 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/UpdateControlRequest.php @@ -0,0 +1,163 @@ +google.cloud.discoveryengine.v1beta.UpdateControlRequest + */ +class UpdateControlRequest extends \Google\Protobuf\Internal\Message +{ + /** + * Required. The Control to update. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + */ + protected $control = null; + /** + * Optional. Indicates which fields in the provided + * [Control][google.cloud.discoveryengine.v1beta.Control] to update. The + * following are NOT supported: + * * [Control.name][google.cloud.discoveryengine.v1beta.Control.name] + * * [Control.solution_type][google.cloud.discoveryengine.v1beta.Control.solution_type] + * If not set or empty, all supported fields are updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + */ + protected $update_mask = null; + + /** + * @param \Google\Cloud\DiscoveryEngine\V1beta\Control $control Required. The Control to update. + * @param \Google\Protobuf\FieldMask $updateMask Optional. Indicates which fields in the provided + * [Control][google.cloud.discoveryengine.v1beta.Control] to update. The + * following are NOT supported: + * + * * [Control.name][google.cloud.discoveryengine.v1beta.Control.name] + * * [Control.solution_type][google.cloud.discoveryengine.v1beta.Control.solution_type] + * + * If not set or empty, all supported fields are updated. + * + * @return \Google\Cloud\DiscoveryEngine\V1beta\UpdateControlRequest + * + * @experimental + */ + public static function build(\Google\Cloud\DiscoveryEngine\V1beta\Control $control, \Google\Protobuf\FieldMask $updateMask): self + { + return (new self()) + ->setControl($control) + ->setUpdateMask($updateMask); + } + + /** + * Constructor. + * + * @param array $data { + * Optional. Data for populating the Message object. + * + * @type \Google\Cloud\DiscoveryEngine\V1beta\Control $control + * Required. The Control to update. + * @type \Google\Protobuf\FieldMask $update_mask + * Optional. Indicates which fields in the provided + * [Control][google.cloud.discoveryengine.v1beta.Control] to update. The + * following are NOT supported: + * * [Control.name][google.cloud.discoveryengine.v1beta.Control.name] + * * [Control.solution_type][google.cloud.discoveryengine.v1beta.Control.solution_type] + * If not set or empty, all supported fields are updated. + * } + */ + public function __construct($data = NULL) { + \GPBMetadata\Google\Cloud\Discoveryengine\V1Beta\ControlService::initOnce(); + parent::__construct($data); + } + + /** + * Required. The Control to update. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * @return \Google\Cloud\DiscoveryEngine\V1beta\Control|null + */ + public function getControl() + { + return $this->control; + } + + public function hasControl() + { + return isset($this->control); + } + + public function clearControl() + { + unset($this->control); + } + + /** + * Required. The Control to update. + * + * Generated from protobuf field .google.cloud.discoveryengine.v1beta.Control control = 1 [(.google.api.field_behavior) = REQUIRED]; + * @param \Google\Cloud\DiscoveryEngine\V1beta\Control $var + * @return $this + */ + public function setControl($var) + { + GPBUtil::checkMessage($var, \Google\Cloud\DiscoveryEngine\V1beta\Control::class); + $this->control = $var; + + return $this; + } + + /** + * Optional. Indicates which fields in the provided + * [Control][google.cloud.discoveryengine.v1beta.Control] to update. The + * following are NOT supported: + * * [Control.name][google.cloud.discoveryengine.v1beta.Control.name] + * * [Control.solution_type][google.cloud.discoveryengine.v1beta.Control.solution_type] + * If not set or empty, all supported fields are updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @return \Google\Protobuf\FieldMask|null + */ + public function getUpdateMask() + { + return $this->update_mask; + } + + public function hasUpdateMask() + { + return isset($this->update_mask); + } + + public function clearUpdateMask() + { + unset($this->update_mask); + } + + /** + * Optional. Indicates which fields in the provided + * [Control][google.cloud.discoveryengine.v1beta.Control] to update. The + * following are NOT supported: + * * [Control.name][google.cloud.discoveryengine.v1beta.Control.name] + * * [Control.solution_type][google.cloud.discoveryengine.v1beta.Control.solution_type] + * If not set or empty, all supported fields are updated. + * + * Generated from protobuf field .google.protobuf.FieldMask update_mask = 2 [(.google.api.field_behavior) = OPTIONAL]; + * @param \Google\Protobuf\FieldMask $var + * @return $this + */ + public function setUpdateMask($var) + { + GPBUtil::checkMessage($var, \Google\Protobuf\FieldMask::class); + $this->update_mask = $var; + + return $this; + } + +} + diff --git a/DiscoveryEngine/src/V1beta/UpdateDocumentRequest.php b/DiscoveryEngine/src/V1beta/UpdateDocumentRequest.php index 2e3d2735260d..b53210b2ff9e 100644 --- a/DiscoveryEngine/src/V1beta/UpdateDocumentRequest.php +++ b/DiscoveryEngine/src/V1beta/UpdateDocumentRequest.php @@ -31,17 +31,16 @@ class UpdateDocumentRequest extends \Google\Protobuf\Internal\Message */ protected $document = null; /** - * If set to true, and the + * If set to `true` and the * [Document][google.cloud.discoveryengine.v1beta.Document] is not found, a - * new [Document][google.cloud.discoveryengine.v1beta.Document] will be - * created. + * new [Document][google.cloud.discoveryengine.v1beta.Document] is be created. * * Generated from protobuf field bool allow_missing = 2; */ protected $allow_missing = false; /** * Indicates which fields in the provided imported 'document' to update. If - * not set, will by default update all fields. + * not set, by default updates all fields. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; */ @@ -59,7 +58,7 @@ class UpdateDocumentRequest extends \Google\Protobuf\Internal\Message * [allow_missing][google.cloud.discoveryengine.v1beta.UpdateDocumentRequest.allow_missing] * is not set, a `NOT_FOUND` error is returned. * @param \Google\Protobuf\FieldMask $updateMask Indicates which fields in the provided imported 'document' to update. If - * not set, will by default update all fields. + * not set, by default updates all fields. * * @return \Google\Cloud\DiscoveryEngine\V1beta\UpdateDocumentRequest * @@ -88,13 +87,12 @@ public static function build(\Google\Cloud\DiscoveryEngine\V1beta\Document $docu * [allow_missing][google.cloud.discoveryengine.v1beta.UpdateDocumentRequest.allow_missing] * is not set, a `NOT_FOUND` error is returned. * @type bool $allow_missing - * If set to true, and the + * If set to `true` and the * [Document][google.cloud.discoveryengine.v1beta.Document] is not found, a - * new [Document][google.cloud.discoveryengine.v1beta.Document] will be - * created. + * new [Document][google.cloud.discoveryengine.v1beta.Document] is be created. * @type \Google\Protobuf\FieldMask $update_mask * Indicates which fields in the provided imported 'document' to update. If - * not set, will by default update all fields. + * not set, by default updates all fields. * } */ public function __construct($data = NULL) { @@ -153,10 +151,9 @@ public function setDocument($var) } /** - * If set to true, and the + * If set to `true` and the * [Document][google.cloud.discoveryengine.v1beta.Document] is not found, a - * new [Document][google.cloud.discoveryengine.v1beta.Document] will be - * created. + * new [Document][google.cloud.discoveryengine.v1beta.Document] is be created. * * Generated from protobuf field bool allow_missing = 2; * @return bool @@ -167,10 +164,9 @@ public function getAllowMissing() } /** - * If set to true, and the + * If set to `true` and the * [Document][google.cloud.discoveryengine.v1beta.Document] is not found, a - * new [Document][google.cloud.discoveryengine.v1beta.Document] will be - * created. + * new [Document][google.cloud.discoveryengine.v1beta.Document] is be created. * * Generated from protobuf field bool allow_missing = 2; * @param bool $var @@ -186,7 +182,7 @@ public function setAllowMissing($var) /** * Indicates which fields in the provided imported 'document' to update. If - * not set, will by default update all fields. + * not set, by default updates all fields. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; * @return \Google\Protobuf\FieldMask|null @@ -208,7 +204,7 @@ public function clearUpdateMask() /** * Indicates which fields in the provided imported 'document' to update. If - * not set, will by default update all fields. + * not set, by default updates all fields. * * Generated from protobuf field .google.protobuf.FieldMask update_mask = 3; * @param \Google\Protobuf\FieldMask $var diff --git a/DiscoveryEngine/src/V1beta/UpdateSchemaRequest.php b/DiscoveryEngine/src/V1beta/UpdateSchemaRequest.php index 86c984cde2e3..cc520d5300aa 100644 --- a/DiscoveryEngine/src/V1beta/UpdateSchemaRequest.php +++ b/DiscoveryEngine/src/V1beta/UpdateSchemaRequest.php @@ -27,8 +27,8 @@ class UpdateSchemaRequest extends \Google\Protobuf\Internal\Message /** * If set to true, and the * [Schema][google.cloud.discoveryengine.v1beta.Schema] is not found, a new - * [Schema][google.cloud.discoveryengine.v1beta.Schema] will be created. In - * this situation, `update_mask` is ignored. + * [Schema][google.cloud.discoveryengine.v1beta.Schema] is created. In this + * situation, `update_mask` is ignored. * * Generated from protobuf field bool allow_missing = 3; */ @@ -46,8 +46,8 @@ class UpdateSchemaRequest extends \Google\Protobuf\Internal\Message * @type bool $allow_missing * If set to true, and the * [Schema][google.cloud.discoveryengine.v1beta.Schema] is not found, a new - * [Schema][google.cloud.discoveryengine.v1beta.Schema] will be created. In - * this situation, `update_mask` is ignored. + * [Schema][google.cloud.discoveryengine.v1beta.Schema] is created. In this + * situation, `update_mask` is ignored. * } */ public function __construct($data = NULL) { @@ -96,8 +96,8 @@ public function setSchema($var) /** * If set to true, and the * [Schema][google.cloud.discoveryengine.v1beta.Schema] is not found, a new - * [Schema][google.cloud.discoveryengine.v1beta.Schema] will be created. In - * this situation, `update_mask` is ignored. + * [Schema][google.cloud.discoveryengine.v1beta.Schema] is created. In this + * situation, `update_mask` is ignored. * * Generated from protobuf field bool allow_missing = 3; * @return bool @@ -110,8 +110,8 @@ public function getAllowMissing() /** * If set to true, and the * [Schema][google.cloud.discoveryengine.v1beta.Schema] is not found, a new - * [Schema][google.cloud.discoveryengine.v1beta.Schema] will be created. In - * this situation, `update_mask` is ignored. + * [Schema][google.cloud.discoveryengine.v1beta.Schema] is created. In this + * situation, `update_mask` is ignored. * * Generated from protobuf field bool allow_missing = 3; * @param bool $var diff --git a/DiscoveryEngine/src/V1beta/UserEvent.php b/DiscoveryEngine/src/V1beta/UserEvent.php index 7a0bb3a092a6..e5efe7ef42f8 100644 --- a/DiscoveryEngine/src/V1beta/UserEvent.php +++ b/DiscoveryEngine/src/V1beta/UserEvent.php @@ -10,7 +10,7 @@ /** * UserEvent captures all metadata information Discovery Engine API needs to - * know about how end users interact with customers' website. + * know about how end users interact with your website. * * Generated from protobuf message google.cloud.discoveryengine.v1beta.UserEvent */ @@ -52,6 +52,31 @@ class UserEvent extends \Google\Protobuf\Internal\Message * Generated from protobuf field string user_pseudo_id = 2 [(.google.api.field_behavior) = REQUIRED]; */ protected $user_pseudo_id = ''; + /** + * The [Engine][google.cloud.discoveryengine.v1beta.Engine] resource name, in + * the form of + * `projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`. + * Optional. Only required for + * [Engine][google.cloud.discoveryengine.v1beta.Engine] produced user events. + * For example, user events from blended search. + * + * Generated from protobuf field string engine = 19 [(.google.api.resource_reference) = { + */ + protected $engine = ''; + /** + * The [DataStore][google.cloud.discoveryengine.v1beta.DataStore] resource + * full name, of the form + * `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`. + * Optional. Only required for user events whose data store can't by + * determined by + * [UserEvent.engine][google.cloud.discoveryengine.v1beta.UserEvent.engine] or + * [UserEvent.documents][google.cloud.discoveryengine.v1beta.UserEvent.documents]. + * If data store is set in the parent of write/import/collect user event + * requests, this field can be omitted. + * + * Generated from protobuf field string data_store = 20 [(.google.api.resource_reference) = { + */ + protected $data_store = ''; /** * Only required for * [UserEventService.ImportUserEvents][google.cloud.discoveryengine.v1beta.UserEventService.ImportUserEvents] @@ -195,7 +220,7 @@ class UserEvent extends \Google\Protobuf\Internal\Message /** * A list of identifiers for the independent experiment groups this user event * belongs to. This is used to distinguish between user events associated with - * different experiment setups on the customer end. + * different experiment setups. * * Generated from protobuf field repeated string tag_ids = 15; */ @@ -275,6 +300,23 @@ class UserEvent extends \Google\Protobuf\Internal\Message * Analytics [Client * ID](https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#clientId) * for this field. + * @type string $engine + * The [Engine][google.cloud.discoveryengine.v1beta.Engine] resource name, in + * the form of + * `projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`. + * Optional. Only required for + * [Engine][google.cloud.discoveryengine.v1beta.Engine] produced user events. + * For example, user events from blended search. + * @type string $data_store + * The [DataStore][google.cloud.discoveryengine.v1beta.DataStore] resource + * full name, of the form + * `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`. + * Optional. Only required for user events whose data store can't by + * determined by + * [UserEvent.engine][google.cloud.discoveryengine.v1beta.UserEvent.engine] or + * [UserEvent.documents][google.cloud.discoveryengine.v1beta.UserEvent.documents]. + * If data store is set in the parent of write/import/collect user event + * requests, this field can be omitted. * @type \Google\Protobuf\Timestamp $event_time * Only required for * [UserEventService.ImportUserEvents][google.cloud.discoveryengine.v1beta.UserEventService.ImportUserEvents] @@ -370,7 +412,7 @@ class UserEvent extends \Google\Protobuf\Internal\Message * @type array|\Google\Protobuf\Internal\RepeatedField $tag_ids * A list of identifiers for the independent experiment groups this user event * belongs to. This is used to distinguish between user events associated with - * different experiment setups on the customer end. + * different experiment setups. * @type array|\Google\Protobuf\Internal\RepeatedField $promotion_ids * The promotion IDs if this is an event associated with promotions. * Currently, this field is restricted to at most one ID. @@ -506,6 +548,84 @@ public function setUserPseudoId($var) return $this; } + /** + * The [Engine][google.cloud.discoveryengine.v1beta.Engine] resource name, in + * the form of + * `projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`. + * Optional. Only required for + * [Engine][google.cloud.discoveryengine.v1beta.Engine] produced user events. + * For example, user events from blended search. + * + * Generated from protobuf field string engine = 19 [(.google.api.resource_reference) = { + * @return string + */ + public function getEngine() + { + return $this->engine; + } + + /** + * The [Engine][google.cloud.discoveryengine.v1beta.Engine] resource name, in + * the form of + * `projects/{project}/locations/{location}/collections/{collection_id}/engines/{engine_id}`. + * Optional. Only required for + * [Engine][google.cloud.discoveryengine.v1beta.Engine] produced user events. + * For example, user events from blended search. + * + * Generated from protobuf field string engine = 19 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setEngine($var) + { + GPBUtil::checkString($var, True); + $this->engine = $var; + + return $this; + } + + /** + * The [DataStore][google.cloud.discoveryengine.v1beta.DataStore] resource + * full name, of the form + * `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`. + * Optional. Only required for user events whose data store can't by + * determined by + * [UserEvent.engine][google.cloud.discoveryengine.v1beta.UserEvent.engine] or + * [UserEvent.documents][google.cloud.discoveryengine.v1beta.UserEvent.documents]. + * If data store is set in the parent of write/import/collect user event + * requests, this field can be omitted. + * + * Generated from protobuf field string data_store = 20 [(.google.api.resource_reference) = { + * @return string + */ + public function getDataStore() + { + return $this->data_store; + } + + /** + * The [DataStore][google.cloud.discoveryengine.v1beta.DataStore] resource + * full name, of the form + * `projects/{project}/locations/{location}/collections/{collection_id}/dataStores/{data_store_id}`. + * Optional. Only required for user events whose data store can't by + * determined by + * [UserEvent.engine][google.cloud.discoveryengine.v1beta.UserEvent.engine] or + * [UserEvent.documents][google.cloud.discoveryengine.v1beta.UserEvent.documents]. + * If data store is set in the parent of write/import/collect user event + * requests, this field can be omitted. + * + * Generated from protobuf field string data_store = 20 [(.google.api.resource_reference) = { + * @param string $var + * @return $this + */ + public function setDataStore($var) + { + GPBUtil::checkString($var, True); + $this->data_store = $var; + + return $this; + } + /** * Only required for * [UserEventService.ImportUserEvents][google.cloud.discoveryengine.v1beta.UserEventService.ImportUserEvents] @@ -1027,7 +1147,7 @@ public function setTransactionInfo($var) /** * A list of identifiers for the independent experiment groups this user event * belongs to. This is used to distinguish between user events associated with - * different experiment setups on the customer end. + * different experiment setups. * * Generated from protobuf field repeated string tag_ids = 15; * @return \Google\Protobuf\Internal\RepeatedField @@ -1040,7 +1160,7 @@ public function getTagIds() /** * A list of identifiers for the independent experiment groups this user event * belongs to. This is used to distinguish between user events associated with - * different experiment setups on the customer end. + * different experiment setups. * * Generated from protobuf field repeated string tag_ids = 15; * @param array|\Google\Protobuf\Internal\RepeatedField $var diff --git a/DiscoveryEngine/src/V1beta/WriteUserEventRequest.php b/DiscoveryEngine/src/V1beta/WriteUserEventRequest.php index 0160c406ea4a..241cdc2c3d6e 100644 --- a/DiscoveryEngine/src/V1beta/WriteUserEventRequest.php +++ b/DiscoveryEngine/src/V1beta/WriteUserEventRequest.php @@ -16,8 +16,16 @@ class WriteUserEventRequest extends \Google\Protobuf\Internal\Message { /** - * Required. The parent DataStore resource name, such as + * Required. The parent resource name. + * If the write user event action is applied in + * [DataStore][google.cloud.discoveryengine.v1beta.DataStore] level, the + * format is: * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. + * If the write user event action is applied in [Location][] level, for + * example, the event with + * [Document][google.cloud.discoveryengine.v1beta.Document] across multiple + * [DataStore][google.cloud.discoveryengine.v1beta.DataStore], the format is: + * `projects/{project}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { */ @@ -28,6 +36,13 @@ class WriteUserEventRequest extends \Google\Protobuf\Internal\Message * Generated from protobuf field optional .google.cloud.discoveryengine.v1beta.UserEvent user_event = 2 [(.google.api.field_behavior) = REQUIRED]; */ protected $user_event = null; + /** + * If set to true, the user event is written asynchronously after + * validation, and the API responds without waiting for the write. + * + * Generated from protobuf field bool write_async = 3; + */ + protected $write_async = false; /** * Constructor. @@ -36,10 +51,21 @@ class WriteUserEventRequest extends \Google\Protobuf\Internal\Message * Optional. Data for populating the Message object. * * @type string $parent - * Required. The parent DataStore resource name, such as + * Required. The parent resource name. + * If the write user event action is applied in + * [DataStore][google.cloud.discoveryengine.v1beta.DataStore] level, the + * format is: * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. + * If the write user event action is applied in [Location][] level, for + * example, the event with + * [Document][google.cloud.discoveryengine.v1beta.Document] across multiple + * [DataStore][google.cloud.discoveryengine.v1beta.DataStore], the format is: + * `projects/{project}/locations/{location}`. * @type \Google\Cloud\DiscoveryEngine\V1beta\UserEvent $user_event * Required. User event to write. + * @type bool $write_async + * If set to true, the user event is written asynchronously after + * validation, and the API responds without waiting for the write. * } */ public function __construct($data = NULL) { @@ -48,8 +74,16 @@ public function __construct($data = NULL) { } /** - * Required. The parent DataStore resource name, such as + * Required. The parent resource name. + * If the write user event action is applied in + * [DataStore][google.cloud.discoveryengine.v1beta.DataStore] level, the + * format is: * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. + * If the write user event action is applied in [Location][] level, for + * example, the event with + * [Document][google.cloud.discoveryengine.v1beta.Document] across multiple + * [DataStore][google.cloud.discoveryengine.v1beta.DataStore], the format is: + * `projects/{project}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @return string @@ -60,8 +94,16 @@ public function getParent() } /** - * Required. The parent DataStore resource name, such as + * Required. The parent resource name. + * If the write user event action is applied in + * [DataStore][google.cloud.discoveryengine.v1beta.DataStore] level, the + * format is: * `projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}`. + * If the write user event action is applied in [Location][] level, for + * example, the event with + * [Document][google.cloud.discoveryengine.v1beta.Document] across multiple + * [DataStore][google.cloud.discoveryengine.v1beta.DataStore], the format is: + * `projects/{project}/locations/{location}`. * * Generated from protobuf field string parent = 1 [(.google.api.field_behavior) = REQUIRED, (.google.api.resource_reference) = { * @param string $var @@ -111,5 +153,33 @@ public function setUserEvent($var) return $this; } + /** + * If set to true, the user event is written asynchronously after + * validation, and the API responds without waiting for the write. + * + * Generated from protobuf field bool write_async = 3; + * @return bool + */ + public function getWriteAsync() + { + return $this->write_async; + } + + /** + * If set to true, the user event is written asynchronously after + * validation, and the API responds without waiting for the write. + * + * Generated from protobuf field bool write_async = 3; + * @param bool $var + * @return $this + */ + public function setWriteAsync($var) + { + GPBUtil::checkBool($var); + $this->write_async = $var; + + return $this; + } + } diff --git a/DiscoveryEngine/src/V1beta/gapic_metadata.json b/DiscoveryEngine/src/V1beta/gapic_metadata.json index e094dec882e0..8785ed2c1406 100644 --- a/DiscoveryEngine/src/V1beta/gapic_metadata.json +++ b/DiscoveryEngine/src/V1beta/gapic_metadata.json @@ -29,6 +29,40 @@ } } }, + "ControlService": { + "clients": { + "grpc": { + "libraryClient": "ControlServiceGapicClient", + "rpcs": { + "CreateControl": { + "methods": [ + "createControl" + ] + }, + "DeleteControl": { + "methods": [ + "deleteControl" + ] + }, + "GetControl": { + "methods": [ + "getControl" + ] + }, + "ListControls": { + "methods": [ + "listControls" + ] + }, + "UpdateControl": { + "methods": [ + "updateControl" + ] + } + } + } + } + }, "SearchService": { "clients": { "grpc": { @@ -258,6 +292,20 @@ } } }, + "ProjectService": { + "clients": { + "grpc": { + "libraryClient": "ProjectServiceGapicClient", + "rpcs": { + "ProvisionProject": { + "methods": [ + "provisionProject" + ] + } + } + } + } + }, "RankService": { "clients": { "grpc": { @@ -325,6 +373,11 @@ "grpc": { "libraryClient": "SearchTuningServiceGapicClient", "rpcs": { + "ListCustomModels": { + "methods": [ + "listCustomModels" + ] + }, "TrainCustomModel": { "methods": [ "trainCustomModel" diff --git a/DiscoveryEngine/src/V1beta/resources/completion_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/completion_service_rest_client_config.php index 4eb0fc578bb1..bbec991cbfb1 100644 --- a/DiscoveryEngine/src/V1beta/resources/completion_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/completion_service_rest_client_config.php @@ -80,6 +80,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/control_service_client_config.json b/DiscoveryEngine/src/V1beta/resources/control_service_client_config.json new file mode 100644 index 000000000000..afd29ab17b6a --- /dev/null +++ b/DiscoveryEngine/src/V1beta/resources/control_service_client_config.json @@ -0,0 +1,59 @@ +{ + "interfaces": { + "google.cloud.discoveryengine.v1beta.ControlService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_2_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "CreateControl": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "DeleteControl": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "GetControl": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "ListControls": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + }, + "UpdateControl": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + } + } + } + } +} diff --git a/DiscoveryEngine/src/V1beta/resources/control_service_descriptor_config.php b/DiscoveryEngine/src/V1beta/resources/control_service_descriptor_config.php new file mode 100644 index 000000000000..f143aa1d4bec --- /dev/null +++ b/DiscoveryEngine/src/V1beta/resources/control_service_descriptor_config.php @@ -0,0 +1,107 @@ + [ + 'google.cloud.discoveryengine.v1beta.ControlService' => [ + 'CreateControl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1beta\Control', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'DeleteControl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Protobuf\GPBEmpty', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'GetControl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1beta\Control', + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'ListControls' => [ + 'pageStreaming' => [ + 'requestPageTokenGetMethod' => 'getPageToken', + 'requestPageTokenSetMethod' => 'setPageToken', + 'requestPageSizeGetMethod' => 'getPageSize', + 'requestPageSizeSetMethod' => 'setPageSize', + 'responsePageTokenGetMethod' => 'getNextPageToken', + 'resourcesGetMethod' => 'getControls', + ], + 'callType' => \Google\ApiCore\Call::PAGINATED_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1beta\ListControlsResponse', + 'headerParams' => [ + [ + 'keyName' => 'parent', + 'fieldAccessors' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateControl' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1beta\Control', + 'headerParams' => [ + [ + 'keyName' => 'control.name', + 'fieldAccessors' => [ + 'getControl', + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'control' => 'projects/{project}/locations/{location}/dataStores/{data_store}/controls/{control}', + 'dataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', + 'engine' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}', + 'projectLocationCollectionDataStore' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}', + 'projectLocationCollectionDataStoreControl' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/controls/{control}', + 'projectLocationCollectionEngineControl' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/controls/{control}', + 'projectLocationDataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', + 'projectLocationDataStoreControl' => 'projects/{project}/locations/{location}/dataStores/{data_store}/controls/{control}', + ], + ], + ], +]; diff --git a/DiscoveryEngine/src/V1beta/resources/control_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/control_service_rest_client_config.php new file mode 100644 index 000000000000..9c9822c3a603 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/resources/control_service_rest_client_config.php @@ -0,0 +1,301 @@ + [ + 'google.cloud.discoveryengine.v1beta.ControlService' => [ + 'CreateControl' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/dataStores/*}/controls', + 'body' => 'control', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/controls', + 'body' => 'control', + 'queryParams' => [ + 'control_id', + ], + ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/collections/*/engines/*}/controls', + 'body' => 'control', + 'queryParams' => [ + 'control_id', + ], + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + 'queryParams' => [ + 'control_id', + ], + ], + 'DeleteControl' => [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/controls/*}', + 'additionalBindings' => [ + [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/controls/*}', + ], + [ + 'method' => 'delete', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/engines/*/controls/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetControl' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/controls/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/controls/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/engines/*/controls/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListControls' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/dataStores/*}/controls', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/controls', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/collections/*/engines/*}/controls', + ], + ], + 'placeholders' => [ + 'parent' => [ + 'getters' => [ + 'getParent', + ], + ], + ], + ], + 'UpdateControl' => [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{control.name=projects/*/locations/*/dataStores/*/controls/*}', + 'body' => 'control', + 'additionalBindings' => [ + [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{control.name=projects/*/locations/*/collections/*/dataStores/*/controls/*}', + 'body' => 'control', + ], + [ + 'method' => 'patch', + 'uriTemplate' => '/v1beta/{control.name=projects/*/locations/*/collections/*/engines/*/controls/*}', + 'body' => 'control', + ], + ], + 'placeholders' => [ + 'control.name' => [ + 'getters' => [ + 'getControl', + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/engines/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector}/operations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/engines/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*}/operations', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/DiscoveryEngine/src/V1beta/resources/conversational_search_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/conversational_search_service_rest_client_config.php index 20ac75a47360..d1856ef38d49 100644 --- a/DiscoveryEngine/src/V1beta/resources/conversational_search_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/conversational_search_service_rest_client_config.php @@ -318,6 +318,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/data_store_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/data_store_service_rest_client_config.php index c975924a1762..496962e0ebf1 100644 --- a/DiscoveryEngine/src/V1beta/resources/data_store_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/data_store_service_rest_client_config.php @@ -121,6 +121,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/document_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/document_service_rest_client_config.php index 8cc929b2bd24..0c878b9ad749 100644 --- a/DiscoveryEngine/src/V1beta/resources/document_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/document_service_rest_client_config.php @@ -159,6 +159,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/engine_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/engine_service_rest_client_config.php index 912b5384b6da..98f66f96d0a6 100644 --- a/DiscoveryEngine/src/V1beta/resources/engine_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/engine_service_rest_client_config.php @@ -122,6 +122,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/grounded_generation_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/grounded_generation_service_rest_client_config.php index 5434dbaa465c..4d0a28e548bd 100644 --- a/DiscoveryEngine/src/V1beta/resources/grounded_generation_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/grounded_generation_service_rest_client_config.php @@ -37,6 +37,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/project_service_client_config.json b/DiscoveryEngine/src/V1beta/resources/project_service_client_config.json new file mode 100644 index 000000000000..aa5f2cd6311f --- /dev/null +++ b/DiscoveryEngine/src/V1beta/resources/project_service_client_config.json @@ -0,0 +1,39 @@ +{ + "interfaces": { + "google.cloud.discoveryengine.v1beta.ProjectService": { + "retry_codes": { + "no_retry_codes": [], + "retry_policy_2_codes": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "no_retry_params": { + "initial_retry_delay_millis": 0, + "retry_delay_multiplier": 0.0, + "max_retry_delay_millis": 0, + "initial_rpc_timeout_millis": 0, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 0, + "total_timeout_millis": 0 + }, + "retry_policy_2_params": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 30000, + "rpc_timeout_multiplier": 1.0, + "max_rpc_timeout_millis": 30000, + "total_timeout_millis": 30000 + } + }, + "methods": { + "ProvisionProject": { + "timeout_millis": 30000, + "retry_codes_name": "retry_policy_2_codes", + "retry_params_name": "retry_policy_2_params" + } + } + } + } +} diff --git a/DiscoveryEngine/src/V1beta/resources/project_service_descriptor_config.php b/DiscoveryEngine/src/V1beta/resources/project_service_descriptor_config.php new file mode 100644 index 000000000000..56752d493e4c --- /dev/null +++ b/DiscoveryEngine/src/V1beta/resources/project_service_descriptor_config.php @@ -0,0 +1,50 @@ + [ + 'google.cloud.discoveryengine.v1beta.ProjectService' => [ + 'ProvisionProject' => [ + 'longRunning' => [ + 'operationReturnType' => '\Google\Cloud\DiscoveryEngine\V1beta\Project', + 'metadataReturnType' => '\Google\Cloud\DiscoveryEngine\V1beta\ProvisionProjectMetadata', + 'initialPollDelayMillis' => '500', + 'pollDelayMultiplier' => '1.5', + 'maxPollDelayMillis' => '5000', + 'totalPollTimeoutMillis' => '300000', + ], + 'callType' => \Google\ApiCore\Call::LONGRUNNING_CALL, + 'headerParams' => [ + [ + 'keyName' => 'name', + 'fieldAccessors' => [ + 'getName', + ], + ], + ], + ], + 'templateMap' => [ + 'project' => 'projects/{project}', + ], + ], + ], +]; diff --git a/DiscoveryEngine/src/V1beta/resources/project_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/project_service_rest_client_config.php new file mode 100644 index 000000000000..ce0774ace3a1 --- /dev/null +++ b/DiscoveryEngine/src/V1beta/resources/project_service_rest_client_config.php @@ -0,0 +1,192 @@ + [ + 'google.cloud.discoveryengine.v1beta.ProjectService' => [ + 'ProvisionProject' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*}:provision', + 'body' => '*', + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'GetOperation' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/engines/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/models/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/operations/*}', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/operations/*}', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + 'ListOperations' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector}/operations', + 'additionalBindings' => [ + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/schemas/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine/targetSites}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/siteSearchEngine}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/engines/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/models/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*}/operations', + ], + [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{name=projects/*}/operations', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], + ], + ], + 'numericEnums' => true, +]; diff --git a/DiscoveryEngine/src/V1beta/resources/rank_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/rank_service_rest_client_config.php index d1fb2b57af1d..eb11212d16b9 100644 --- a/DiscoveryEngine/src/V1beta/resources/rank_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/rank_service_rest_client_config.php @@ -37,6 +37,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/recommendation_service_descriptor_config.php b/DiscoveryEngine/src/V1beta/resources/recommendation_service_descriptor_config.php index 16943254074a..9a9c94142881 100644 --- a/DiscoveryEngine/src/V1beta/resources/recommendation_service_descriptor_config.php +++ b/DiscoveryEngine/src/V1beta/resources/recommendation_service_descriptor_config.php @@ -36,10 +36,14 @@ ], ], 'templateMap' => [ + 'dataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', 'document' => 'projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}', + 'engine' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}', + 'projectLocationCollectionDataStore' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}', 'projectLocationCollectionDataStoreBranchDocument' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}', 'projectLocationCollectionDataStoreServingConfig' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/servingConfigs/{serving_config}', 'projectLocationCollectionEngineServingConfig' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}/servingConfigs/{serving_config}', + 'projectLocationDataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', 'projectLocationDataStoreBranchDocument' => 'projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}', 'projectLocationDataStoreServingConfig' => 'projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}', 'servingConfig' => 'projects/{project}/locations/{location}/dataStores/{data_store}/servingConfigs/{serving_config}', diff --git a/DiscoveryEngine/src/V1beta/resources/recommendation_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/recommendation_service_rest_client_config.php index f1659c9d6283..ee7dbb9f3745 100644 --- a/DiscoveryEngine/src/V1beta/resources/recommendation_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/recommendation_service_rest_client_config.php @@ -49,6 +49,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/schema_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/schema_service_rest_client_config.php index d31a6cca3f49..4d21b360dfaa 100644 --- a/DiscoveryEngine/src/V1beta/resources/schema_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/schema_service_rest_client_config.php @@ -121,6 +121,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/search_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/search_service_rest_client_config.php index 2697aaedd145..95636d0e6ebb 100644 --- a/DiscoveryEngine/src/V1beta/resources/search_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/search_service_rest_client_config.php @@ -49,6 +49,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/search_tuning_service_client_config.json b/DiscoveryEngine/src/V1beta/resources/search_tuning_service_client_config.json index 38f897b9d2b5..8b641eb9ee4d 100644 --- a/DiscoveryEngine/src/V1beta/resources/search_tuning_service_client_config.json +++ b/DiscoveryEngine/src/V1beta/resources/search_tuning_service_client_config.json @@ -16,6 +16,11 @@ } }, "methods": { + "ListCustomModels": { + "timeout_millis": 60000, + "retry_codes_name": "no_retry_codes", + "retry_params_name": "no_retry_params" + }, "TrainCustomModel": { "timeout_millis": 60000, "retry_codes_name": "no_retry_codes", diff --git a/DiscoveryEngine/src/V1beta/resources/search_tuning_service_descriptor_config.php b/DiscoveryEngine/src/V1beta/resources/search_tuning_service_descriptor_config.php index f299636d2ed1..b1853e298598 100644 --- a/DiscoveryEngine/src/V1beta/resources/search_tuning_service_descriptor_config.php +++ b/DiscoveryEngine/src/V1beta/resources/search_tuning_service_descriptor_config.php @@ -42,6 +42,18 @@ ], ], ], + 'ListCustomModels' => [ + 'callType' => \Google\ApiCore\Call::UNARY_CALL, + 'responseType' => 'Google\Cloud\DiscoveryEngine\V1beta\ListCustomModelsResponse', + 'headerParams' => [ + [ + 'keyName' => 'data_store', + 'fieldAccessors' => [ + 'getDataStore', + ], + ], + ], + ], 'templateMap' => [ 'dataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', 'projectLocationCollectionDataStore' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}', diff --git a/DiscoveryEngine/src/V1beta/resources/search_tuning_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/search_tuning_service_rest_client_config.php index 1d840bc5cbe1..c3805d2e45b1 100644 --- a/DiscoveryEngine/src/V1beta/resources/search_tuning_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/search_tuning_service_rest_client_config.php @@ -23,6 +23,17 @@ return [ 'interfaces' => [ 'google.cloud.discoveryengine.v1beta.SearchTuningService' => [ + 'ListCustomModels' => [ + 'method' => 'get', + 'uriTemplate' => '/v1beta/{data_store=projects/*/locations/*/collections/*/dataStores/*}/customModels', + 'placeholders' => [ + 'data_store' => [ + 'getters' => [ + 'getDataStore', + ], + ], + ], + ], 'TrainCustomModel' => [ 'method' => 'post', 'uriTemplate' => '/v1beta/{data_store=projects/*/locations/*/collections/*/dataStores/*}:trainCustomModel', @@ -37,6 +48,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/serving_config_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/serving_config_service_rest_client_config.php index 8d4f817eea64..76e47fbeb6c5 100644 --- a/DiscoveryEngine/src/V1beta/resources/serving_config_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/serving_config_service_rest_client_config.php @@ -92,6 +92,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/site_search_engine_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/site_search_engine_service_rest_client_config.php index 4b661385a6bf..1af6f9ee4de2 100644 --- a/DiscoveryEngine/src/V1beta/resources/site_search_engine_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/site_search_engine_service_rest_client_config.php @@ -231,6 +231,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/src/V1beta/resources/user_event_service_descriptor_config.php b/DiscoveryEngine/src/V1beta/resources/user_event_service_descriptor_config.php index 535ecc8a474b..fb0e96272997 100644 --- a/DiscoveryEngine/src/V1beta/resources/user_event_service_descriptor_config.php +++ b/DiscoveryEngine/src/V1beta/resources/user_event_service_descriptor_config.php @@ -69,6 +69,7 @@ 'templateMap' => [ 'dataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', 'document' => 'projects/{project}/locations/{location}/dataStores/{data_store}/branches/{branch}/documents/{document}', + 'engine' => 'projects/{project}/locations/{location}/collections/{collection}/engines/{engine}', 'projectLocationCollectionDataStore' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}', 'projectLocationCollectionDataStoreBranchDocument' => 'projects/{project}/locations/{location}/collections/{collection}/dataStores/{data_store}/branches/{branch}/documents/{document}', 'projectLocationDataStore' => 'projects/{project}/locations/{location}/dataStores/{data_store}', diff --git a/DiscoveryEngine/src/V1beta/resources/user_event_service_rest_client_config.php b/DiscoveryEngine/src/V1beta/resources/user_event_service_rest_client_config.php index 18e119a11b38..a3988060f61e 100644 --- a/DiscoveryEngine/src/V1beta/resources/user_event_service_rest_client_config.php +++ b/DiscoveryEngine/src/V1beta/resources/user_event_service_rest_client_config.php @@ -69,6 +69,11 @@ 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*/collections/*/dataStores/*}/userEvents:write', 'body' => 'user_event', ], + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{parent=projects/*/locations/*}/userEvents:write', + 'body' => 'user_event', + ], ], 'placeholders' => [ 'parent' => [ @@ -80,6 +85,25 @@ ], ], 'google.longrunning.Operations' => [ + 'CancelOperation' => [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + 'additionalBindings' => [ + [ + 'method' => 'post', + 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/dataStores/*/branches/*/operations/*}:cancel', + 'body' => '*', + ], + ], + 'placeholders' => [ + 'name' => [ + 'getters' => [ + 'getName', + ], + ], + ], + ], 'GetOperation' => [ 'method' => 'get', 'uriTemplate' => '/v1beta/{name=projects/*/locations/*/collections/*/dataConnector/operations/*}', diff --git a/DiscoveryEngine/tests/Unit/V1/Client/CompletionServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/CompletionServiceClientTest.php index d0f2b537648a..b4cb0bad4bc0 100644 --- a/DiscoveryEngine/tests/Unit/V1/Client/CompletionServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1/Client/CompletionServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1\Client\CompletionServiceClient; @@ -34,6 +33,7 @@ use Google\Cloud\DiscoveryEngine\V1\ImportSuggestionDenyListEntriesResponse; use Google\Cloud\DiscoveryEngine\V1\PurgeSuggestionDenyListEntriesRequest; use Google\Cloud\DiscoveryEngine\V1\PurgeSuggestionDenyListEntriesResponse; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; diff --git a/DiscoveryEngine/tests/Unit/V1/Client/ControlServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/ControlServiceClientTest.php new file mode 100644 index 000000000000..034cb4964742 --- /dev/null +++ b/DiscoveryEngine/tests/Unit/V1/Client/ControlServiceClientTest.php @@ -0,0 +1,478 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return ControlServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ControlServiceClient($options); + } + + /** @test */ + public function createControlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Control(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $control = new Control(); + $controlDisplayName = 'controlDisplayName-1438249776'; + $control->setDisplayName($controlDisplayName); + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $control->setSolutionType($controlSolutionType); + $controlId = 'controlId637416253'; + $request = (new CreateControlRequest()) + ->setParent($formattedParent) + ->setControl($control) + ->setControlId($controlId); + $response = $gapicClient->createControl($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ControlService/CreateControl', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getControl(); + $this->assertProtobufEquals($control, $actualValue); + $actualValue = $actualRequestObject->getControlId(); + $this->assertProtobufEquals($controlId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createControlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $control = new Control(); + $controlDisplayName = 'controlDisplayName-1438249776'; + $control->setDisplayName($controlDisplayName); + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $control->setSolutionType($controlSolutionType); + $controlId = 'controlId637416253'; + $request = (new CreateControlRequest()) + ->setParent($formattedParent) + ->setControl($control) + ->setControlId($controlId); + try { + $gapicClient->createControl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteControlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->controlName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[CONTROL]'); + $request = (new DeleteControlRequest())->setName($formattedName); + $gapicClient->deleteControl($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ControlService/DeleteControl', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteControlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->controlName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[CONTROL]'); + $request = (new DeleteControlRequest())->setName($formattedName); + try { + $gapicClient->deleteControl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getControlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Control(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->controlName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[CONTROL]'); + $request = (new GetControlRequest())->setName($formattedName); + $response = $gapicClient->getControl($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ControlService/GetControl', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getControlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->controlName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[CONTROL]'); + $request = (new GetControlRequest())->setName($formattedName); + try { + $gapicClient->getControl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listControlsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $controlsElement = new Control(); + $controls = [$controlsElement]; + $expectedResponse = new ListControlsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setControls($controls); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $request = (new ListControlsRequest())->setParent($formattedParent); + $response = $gapicClient->listControls($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getControls()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ControlService/ListControls', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listControlsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $request = (new ListControlsRequest())->setParent($formattedParent); + try { + $gapicClient->listControls($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateControlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Control(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $control = new Control(); + $controlDisplayName = 'controlDisplayName-1438249776'; + $control->setDisplayName($controlDisplayName); + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $control->setSolutionType($controlSolutionType); + $request = (new UpdateControlRequest())->setControl($control); + $response = $gapicClient->updateControl($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ControlService/UpdateControl', $actualFuncCall); + $actualValue = $actualRequestObject->getControl(); + $this->assertProtobufEquals($control, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateControlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $control = new Control(); + $controlDisplayName = 'controlDisplayName-1438249776'; + $control->setDisplayName($controlDisplayName); + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $control->setSolutionType($controlSolutionType); + $request = (new UpdateControlRequest())->setControl($control); + try { + $gapicClient->updateControl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createControlAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Control(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $control = new Control(); + $controlDisplayName = 'controlDisplayName-1438249776'; + $control->setDisplayName($controlDisplayName); + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $control->setSolutionType($controlSolutionType); + $controlId = 'controlId637416253'; + $request = (new CreateControlRequest()) + ->setParent($formattedParent) + ->setControl($control) + ->setControlId($controlId); + $response = $gapicClient->createControlAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ControlService/CreateControl', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getControl(); + $this->assertProtobufEquals($control, $actualValue); + $actualValue = $actualRequestObject->getControlId(); + $this->assertProtobufEquals($controlId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/DiscoveryEngine/tests/Unit/V1/Client/ConversationalSearchServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/ConversationalSearchServiceClientTest.php index aec2cfe901d9..6903d961f7a5 100644 --- a/DiscoveryEngine/tests/Unit/V1/Client/ConversationalSearchServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1/Client/ConversationalSearchServiceClientTest.php @@ -26,17 +26,29 @@ use Google\ApiCore\CredentialsWrapper; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; +use Google\Cloud\DiscoveryEngine\V1\Answer; +use Google\Cloud\DiscoveryEngine\V1\AnswerQueryRequest; +use Google\Cloud\DiscoveryEngine\V1\AnswerQueryResponse; use Google\Cloud\DiscoveryEngine\V1\Client\ConversationalSearchServiceClient; use Google\Cloud\DiscoveryEngine\V1\Conversation; use Google\Cloud\DiscoveryEngine\V1\ConverseConversationRequest; use Google\Cloud\DiscoveryEngine\V1\ConverseConversationResponse; use Google\Cloud\DiscoveryEngine\V1\CreateConversationRequest; +use Google\Cloud\DiscoveryEngine\V1\CreateSessionRequest; use Google\Cloud\DiscoveryEngine\V1\DeleteConversationRequest; +use Google\Cloud\DiscoveryEngine\V1\DeleteSessionRequest; +use Google\Cloud\DiscoveryEngine\V1\GetAnswerRequest; use Google\Cloud\DiscoveryEngine\V1\GetConversationRequest; +use Google\Cloud\DiscoveryEngine\V1\GetSessionRequest; use Google\Cloud\DiscoveryEngine\V1\ListConversationsRequest; use Google\Cloud\DiscoveryEngine\V1\ListConversationsResponse; +use Google\Cloud\DiscoveryEngine\V1\ListSessionsRequest; +use Google\Cloud\DiscoveryEngine\V1\ListSessionsResponse; +use Google\Cloud\DiscoveryEngine\V1\Query; +use Google\Cloud\DiscoveryEngine\V1\Session; use Google\Cloud\DiscoveryEngine\V1\TextInput; use Google\Cloud\DiscoveryEngine\V1\UpdateConversationRequest; +use Google\Cloud\DiscoveryEngine\V1\UpdateSessionRequest; use Google\Protobuf\GPBEmpty; use Google\Rpc\Code; use stdClass; @@ -71,6 +83,85 @@ private function createClient(array $options = []) return new ConversationalSearchServiceClient($options); } + /** @test */ + public function answerQueryTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $answerQueryToken = 'answerQueryToken886927553'; + $expectedResponse = new AnswerQueryResponse(); + $expectedResponse->setAnswerQueryToken($answerQueryToken); + $transport->addResponse($expectedResponse); + // Mock request + $formattedServingConfig = $gapicClient->servingConfigName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]', + '[SERVING_CONFIG]' + ); + $query = new Query(); + $request = (new AnswerQueryRequest())->setServingConfig($formattedServingConfig)->setQuery($query); + $response = $gapicClient->answerQuery($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ConversationalSearchService/AnswerQuery', $actualFuncCall); + $actualValue = $actualRequestObject->getServingConfig(); + $this->assertProtobufEquals($formattedServingConfig, $actualValue); + $actualValue = $actualRequestObject->getQuery(); + $this->assertProtobufEquals($query, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function answerQueryExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedServingConfig = $gapicClient->servingConfigName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]', + '[SERVING_CONFIG]' + ); + $query = new Query(); + $request = (new AnswerQueryRequest())->setServingConfig($formattedServingConfig)->setQuery($query); + try { + $gapicClient->answerQuery($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function converseConversationTest() { @@ -215,6 +306,80 @@ public function createConversationExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function createSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $userPseudoId = 'userPseudoId-1850666040'; + $expectedResponse = new Session(); + $expectedResponse->setName($name); + $expectedResponse->setUserPseudoId($userPseudoId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $session = new Session(); + $request = (new CreateSessionRequest())->setParent($formattedParent)->setSession($session); + $response = $gapicClient->createSession($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.cloud.discoveryengine.v1.ConversationalSearchService/CreateSession', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($session, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createSessionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $session = new Session(); + $request = (new CreateSessionRequest())->setParent($formattedParent)->setSession($session); + try { + $gapicClient->createSession($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function deleteConversationTest() { @@ -280,6 +445,138 @@ public function deleteConversationExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function deleteSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[SESSION]'); + $request = (new DeleteSessionRequest())->setName($formattedName); + $gapicClient->deleteSession($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame( + '/google.cloud.discoveryengine.v1.ConversationalSearchService/DeleteSession', + $actualFuncCall + ); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteSessionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[SESSION]'); + $request = (new DeleteSessionRequest())->setName($formattedName); + try { + $gapicClient->deleteSession($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAnswerTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $answerText = 'answerText-311499506'; + $expectedResponse = new Answer(); + $expectedResponse->setName($name2); + $expectedResponse->setAnswerText($answerText); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->answerName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[SESSION]', '[ANSWER]'); + $request = (new GetAnswerRequest())->setName($formattedName); + $response = $gapicClient->getAnswer($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ConversationalSearchService/GetAnswer', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getAnswerExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->answerName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[SESSION]', '[ANSWER]'); + $request = (new GetAnswerRequest())->setName($formattedName); + try { + $gapicClient->getAnswer($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function getConversationTest() { @@ -350,6 +647,73 @@ public function getConversationExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function getSessionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $userPseudoId = 'userPseudoId-1850666040'; + $expectedResponse = new Session(); + $expectedResponse->setName($name2); + $expectedResponse->setUserPseudoId($userPseudoId); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[SESSION]'); + $request = (new GetSessionRequest())->setName($formattedName); + $response = $gapicClient->getSession($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ConversationalSearchService/GetSession', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getSessionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->sessionName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[SESSION]'); + $request = (new GetSessionRequest())->setName($formattedName); + try { + $gapicClient->getSession($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function listConversationsTest() { @@ -424,6 +788,77 @@ public function listConversationsExceptionTest() $this->assertTrue($transport->isExhausted()); } + /** @test */ + public function listSessionsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $sessionsElement = new Session(); + $sessions = [$sessionsElement]; + $expectedResponse = new ListSessionsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setSessions($sessions); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $request = (new ListSessionsRequest())->setParent($formattedParent); + $response = $gapicClient->listSessions($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getSessions()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ConversationalSearchService/ListSessions', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listSessionsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $request = (new ListSessionsRequest())->setParent($formattedParent); + try { + $gapicClient->listSessions($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function updateConversationTest() { @@ -495,7 +930,7 @@ public function updateConversationExceptionTest() } /** @test */ - public function converseConversationAsyncTest() + public function updateSessionTest() { $transport = $this->createTransport(); $gapicClient = $this->createClient([ @@ -503,24 +938,98 @@ public function converseConversationAsyncTest() ]); $this->assertTrue($transport->isExhausted()); // Mock response - $expectedResponse = new ConverseConversationResponse(); + $name = 'name3373707'; + $userPseudoId = 'userPseudoId-1850666040'; + $expectedResponse = new Session(); + $expectedResponse->setName($name); + $expectedResponse->setUserPseudoId($userPseudoId); $transport->addResponse($expectedResponse); // Mock request - $formattedName = $gapicClient->conversationName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[CONVERSATION]'); - $query = new TextInput(); - $request = (new ConverseConversationRequest())->setName($formattedName)->setQuery($query); - $response = $gapicClient->converseConversationAsync($request)->wait(); + $session = new Session(); + $request = (new UpdateSessionRequest())->setSession($session); + $response = $gapicClient->updateSession($request); $this->assertEquals($expectedResponse, $response); $actualRequests = $transport->popReceivedCalls(); $this->assertSame(1, count($actualRequests)); $actualFuncCall = $actualRequests[0]->getFuncCall(); $actualRequestObject = $actualRequests[0]->getRequestObject(); $this->assertSame( - '/google.cloud.discoveryengine.v1.ConversationalSearchService/ConverseConversation', + '/google.cloud.discoveryengine.v1.ConversationalSearchService/UpdateSession', $actualFuncCall ); - $actualValue = $actualRequestObject->getName(); - $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualRequestObject->getSession(); + $this->assertProtobufEquals($session, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateSessionExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $session = new Session(); + $request = (new UpdateSessionRequest())->setSession($session); + try { + $gapicClient->updateSession($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function answerQueryAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $answerQueryToken = 'answerQueryToken886927553'; + $expectedResponse = new AnswerQueryResponse(); + $expectedResponse->setAnswerQueryToken($answerQueryToken); + $transport->addResponse($expectedResponse); + // Mock request + $formattedServingConfig = $gapicClient->servingConfigName( + '[PROJECT]', + '[LOCATION]', + '[DATA_STORE]', + '[SERVING_CONFIG]' + ); + $query = new Query(); + $request = (new AnswerQueryRequest())->setServingConfig($formattedServingConfig)->setQuery($query); + $response = $gapicClient->answerQueryAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ConversationalSearchService/AnswerQuery', $actualFuncCall); + $actualValue = $actualRequestObject->getServingConfig(); + $this->assertProtobufEquals($formattedServingConfig, $actualValue); $actualValue = $actualRequestObject->getQuery(); $this->assertProtobufEquals($query, $actualValue); $this->assertTrue($transport->isExhausted()); diff --git a/DiscoveryEngine/tests/Unit/V1/Client/DataStoreServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/DataStoreServiceClientTest.php index 65a46e0ab1a9..3d77697c7801 100644 --- a/DiscoveryEngine/tests/Unit/V1/Client/DataStoreServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1/Client/DataStoreServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1\Client\DataStoreServiceClient; @@ -35,6 +34,7 @@ use Google\Cloud\DiscoveryEngine\V1\ListDataStoresRequest; use Google\Cloud\DiscoveryEngine\V1\ListDataStoresResponse; use Google\Cloud\DiscoveryEngine\V1\UpdateDataStoreRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; diff --git a/DiscoveryEngine/tests/Unit/V1/Client/DocumentServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/DocumentServiceClientTest.php index d7ab61894e83..1b7ece406457 100644 --- a/DiscoveryEngine/tests/Unit/V1/Client/DocumentServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1/Client/DocumentServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1\Client\DocumentServiceClient; @@ -39,6 +38,7 @@ use Google\Cloud\DiscoveryEngine\V1\PurgeDocumentsRequest; use Google\Cloud\DiscoveryEngine\V1\PurgeDocumentsResponse; use Google\Cloud\DiscoveryEngine\V1\UpdateDocumentRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; diff --git a/DiscoveryEngine/tests/Unit/V1/Client/EngineServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/EngineServiceClientTest.php index 3685f7d67432..36b41762afc7 100644 --- a/DiscoveryEngine/tests/Unit/V1/Client/EngineServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1/Client/EngineServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1\Client\EngineServiceClient; @@ -36,6 +35,7 @@ use Google\Cloud\DiscoveryEngine\V1\ListEnginesResponse; use Google\Cloud\DiscoveryEngine\V1\SolutionType; use Google\Cloud\DiscoveryEngine\V1\UpdateEngineRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; diff --git a/DiscoveryEngine/tests/Unit/V1/Client/GroundedGenerationServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/GroundedGenerationServiceClientTest.php new file mode 100644 index 000000000000..fce50c2ed29f --- /dev/null +++ b/DiscoveryEngine/tests/Unit/V1/Client/GroundedGenerationServiceClientTest.php @@ -0,0 +1,157 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return GroundedGenerationServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new GroundedGenerationServiceClient($options); + } + + /** @test */ + public function checkGroundingTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $supportScore = -13206883; + $expectedResponse = new CheckGroundingResponse(); + $expectedResponse->setSupportScore($supportScore); + $transport->addResponse($expectedResponse); + // Mock request + $formattedGroundingConfig = $gapicClient->groundingConfigName('[PROJECT]', '[LOCATION]', '[GROUNDING_CONFIG]'); + $request = (new CheckGroundingRequest())->setGroundingConfig($formattedGroundingConfig); + $response = $gapicClient->checkGrounding($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.GroundedGenerationService/CheckGrounding', $actualFuncCall); + $actualValue = $actualRequestObject->getGroundingConfig(); + $this->assertProtobufEquals($formattedGroundingConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function checkGroundingExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedGroundingConfig = $gapicClient->groundingConfigName('[PROJECT]', '[LOCATION]', '[GROUNDING_CONFIG]'); + $request = (new CheckGroundingRequest())->setGroundingConfig($formattedGroundingConfig); + try { + $gapicClient->checkGrounding($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function checkGroundingAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $supportScore = -13206883; + $expectedResponse = new CheckGroundingResponse(); + $expectedResponse->setSupportScore($supportScore); + $transport->addResponse($expectedResponse); + // Mock request + $formattedGroundingConfig = $gapicClient->groundingConfigName('[PROJECT]', '[LOCATION]', '[GROUNDING_CONFIG]'); + $request = (new CheckGroundingRequest())->setGroundingConfig($formattedGroundingConfig); + $response = $gapicClient->checkGroundingAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.GroundedGenerationService/CheckGrounding', $actualFuncCall); + $actualValue = $actualRequestObject->getGroundingConfig(); + $this->assertProtobufEquals($formattedGroundingConfig, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/DiscoveryEngine/tests/Unit/V1/Client/ProjectServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/ProjectServiceClientTest.php new file mode 100644 index 000000000000..b67d72d9176f --- /dev/null +++ b/DiscoveryEngine/tests/Unit/V1/Client/ProjectServiceClientTest.php @@ -0,0 +1,280 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return ProjectServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ProjectServiceClient($options); + } + + /** @test */ + public function provisionProjectTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/provisionProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new Project(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/provisionProjectTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $acceptDataUseTerms = false; + $dataUseTermsVersion = 'dataUseTermsVersion1209366547'; + $request = (new ProvisionProjectRequest()) + ->setName($formattedName) + ->setAcceptDataUseTerms($acceptDataUseTerms) + ->setDataUseTermsVersion($dataUseTermsVersion); + $response = $gapicClient->provisionProject($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ProjectService/ProvisionProject', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getAcceptDataUseTerms(); + $this->assertProtobufEquals($acceptDataUseTerms, $actualValue); + $actualValue = $actualApiRequestObject->getDataUseTermsVersion(); + $this->assertProtobufEquals($dataUseTermsVersion, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/provisionProjectTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function provisionProjectExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/provisionProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $acceptDataUseTerms = false; + $dataUseTermsVersion = 'dataUseTermsVersion1209366547'; + $request = (new ProvisionProjectRequest()) + ->setName($formattedName) + ->setAcceptDataUseTerms($acceptDataUseTerms) + ->setDataUseTermsVersion($dataUseTermsVersion); + $response = $gapicClient->provisionProject($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/provisionProjectTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function provisionProjectAsyncTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/provisionProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new Project(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/provisionProjectTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $acceptDataUseTerms = false; + $dataUseTermsVersion = 'dataUseTermsVersion1209366547'; + $request = (new ProvisionProjectRequest()) + ->setName($formattedName) + ->setAcceptDataUseTerms($acceptDataUseTerms) + ->setDataUseTermsVersion($dataUseTermsVersion); + $response = $gapicClient->provisionProjectAsync($request)->wait(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.ProjectService/ProvisionProject', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getAcceptDataUseTerms(); + $this->assertProtobufEquals($acceptDataUseTerms, $actualValue); + $actualValue = $actualApiRequestObject->getDataUseTermsVersion(); + $this->assertProtobufEquals($dataUseTermsVersion, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/provisionProjectTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } +} diff --git a/DiscoveryEngine/tests/Unit/V1/Client/RankServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/RankServiceClientTest.php new file mode 100644 index 000000000000..2e3ca29b0188 --- /dev/null +++ b/DiscoveryEngine/tests/Unit/V1/Client/RankServiceClientTest.php @@ -0,0 +1,160 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return RankServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new RankServiceClient($options); + } + + /** @test */ + public function rankTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new RankResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedRankingConfig = $gapicClient->rankingConfigName('[PROJECT]', '[LOCATION]', '[RANKING_CONFIG]'); + $records = []; + $request = (new RankRequest())->setRankingConfig($formattedRankingConfig)->setRecords($records); + $response = $gapicClient->rank($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.RankService/Rank', $actualFuncCall); + $actualValue = $actualRequestObject->getRankingConfig(); + $this->assertProtobufEquals($formattedRankingConfig, $actualValue); + $actualValue = $actualRequestObject->getRecords(); + $this->assertProtobufEquals($records, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function rankExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedRankingConfig = $gapicClient->rankingConfigName('[PROJECT]', '[LOCATION]', '[RANKING_CONFIG]'); + $records = []; + $request = (new RankRequest())->setRankingConfig($formattedRankingConfig)->setRecords($records); + try { + $gapicClient->rank($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function rankAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new RankResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedRankingConfig = $gapicClient->rankingConfigName('[PROJECT]', '[LOCATION]', '[RANKING_CONFIG]'); + $records = []; + $request = (new RankRequest())->setRankingConfig($formattedRankingConfig)->setRecords($records); + $response = $gapicClient->rankAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1.RankService/Rank', $actualFuncCall); + $actualValue = $actualRequestObject->getRankingConfig(); + $this->assertProtobufEquals($formattedRankingConfig, $actualValue); + $actualValue = $actualRequestObject->getRecords(); + $this->assertProtobufEquals($records, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/DiscoveryEngine/tests/Unit/V1/Client/SchemaServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/SchemaServiceClientTest.php index c4a65a5f8eb2..ef306fecce58 100644 --- a/DiscoveryEngine/tests/Unit/V1/Client/SchemaServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1/Client/SchemaServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1\Client\SchemaServiceClient; @@ -35,6 +34,7 @@ use Google\Cloud\DiscoveryEngine\V1\ListSchemasResponse; use Google\Cloud\DiscoveryEngine\V1\Schema; use Google\Cloud\DiscoveryEngine\V1\UpdateSchemaRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; diff --git a/DiscoveryEngine/tests/Unit/V1/Client/SiteSearchEngineServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/SiteSearchEngineServiceClientTest.php index 2bfd7b8b5570..145a2e54f5b3 100644 --- a/DiscoveryEngine/tests/Unit/V1/Client/SiteSearchEngineServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1/Client/SiteSearchEngineServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1\BatchCreateTargetSitesRequest; @@ -49,6 +48,7 @@ use Google\Cloud\DiscoveryEngine\V1\SiteSearchEngine; use Google\Cloud\DiscoveryEngine\V1\TargetSite; use Google\Cloud\DiscoveryEngine\V1\UpdateTargetSiteRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; @@ -365,11 +365,13 @@ public function createTargetSiteTest() $providedUriPattern = 'providedUriPattern437506913'; $exactMatch = false; $generatedUriPattern = 'generatedUriPattern-1580317427'; + $rootDomainUri = 'rootDomainUri-789734674'; $expectedResponse = new TargetSite(); $expectedResponse->setName($name); $expectedResponse->setProvidedUriPattern($providedUriPattern); $expectedResponse->setExactMatch($exactMatch); $expectedResponse->setGeneratedUriPattern($generatedUriPattern); + $expectedResponse->setRootDomainUri($rootDomainUri); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -1013,11 +1015,13 @@ public function getTargetSiteTest() $providedUriPattern = 'providedUriPattern437506913'; $exactMatch = false; $generatedUriPattern = 'generatedUriPattern-1580317427'; + $rootDomainUri = 'rootDomainUri-789734674'; $expectedResponse = new TargetSite(); $expectedResponse->setName($name2); $expectedResponse->setProvidedUriPattern($providedUriPattern); $expectedResponse->setExactMatch($exactMatch); $expectedResponse->setGeneratedUriPattern($generatedUriPattern); + $expectedResponse->setRootDomainUri($rootDomainUri); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->targetSiteName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[TARGET_SITE]'); @@ -1295,11 +1299,13 @@ public function updateTargetSiteTest() $providedUriPattern = 'providedUriPattern437506913'; $exactMatch = false; $generatedUriPattern = 'generatedUriPattern-1580317427'; + $rootDomainUri = 'rootDomainUri-789734674'; $expectedResponse = new TargetSite(); $expectedResponse->setName($name); $expectedResponse->setProvidedUriPattern($providedUriPattern); $expectedResponse->setExactMatch($exactMatch); $expectedResponse->setGeneratedUriPattern($generatedUriPattern); + $expectedResponse->setRootDomainUri($rootDomainUri); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); diff --git a/DiscoveryEngine/tests/Unit/V1/Client/UserEventServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1/Client/UserEventServiceClientTest.php index 2760c583dca4..14348b87e534 100644 --- a/DiscoveryEngine/tests/Unit/V1/Client/UserEventServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1/Client/UserEventServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Api\HttpBody; @@ -34,6 +33,7 @@ use Google\Cloud\DiscoveryEngine\V1\ImportUserEventsResponse; use Google\Cloud\DiscoveryEngine\V1\UserEvent; use Google\Cloud\DiscoveryEngine\V1\WriteUserEventRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; @@ -278,6 +278,8 @@ public function writeUserEventTest() // Mock response $eventType = 'eventType984376767'; $userPseudoId = 'userPseudoId-1850666040'; + $engine = 'engine-1298662846'; + $dataStore = 'dataStore1619682316'; $directUserRequest = false; $sessionId = 'sessionId1661853540'; $attributionToken = 'attributionToken-729411015'; @@ -285,6 +287,8 @@ public function writeUserEventTest() $expectedResponse = new UserEvent(); $expectedResponse->setEventType($eventType); $expectedResponse->setUserPseudoId($userPseudoId); + $expectedResponse->setEngine($engine); + $expectedResponse->setDataStore($dataStore); $expectedResponse->setDirectUserRequest($directUserRequest); $expectedResponse->setSessionId($sessionId); $expectedResponse->setAttributionToken($attributionToken); diff --git a/DiscoveryEngine/tests/Unit/V1beta/Client/CompletionServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1beta/Client/CompletionServiceClientTest.php index 5165fe07b9da..5c406405b79f 100644 --- a/DiscoveryEngine/tests/Unit/V1beta/Client/CompletionServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1beta/Client/CompletionServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1beta\Client\CompletionServiceClient; @@ -34,6 +33,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\ImportSuggestionDenyListEntriesResponse; use Google\Cloud\DiscoveryEngine\V1beta\PurgeSuggestionDenyListEntriesRequest; use Google\Cloud\DiscoveryEngine\V1beta\PurgeSuggestionDenyListEntriesResponse; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; diff --git a/DiscoveryEngine/tests/Unit/V1beta/Client/ControlServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1beta/Client/ControlServiceClientTest.php new file mode 100644 index 000000000000..99f3f95fdf1e --- /dev/null +++ b/DiscoveryEngine/tests/Unit/V1beta/Client/ControlServiceClientTest.php @@ -0,0 +1,478 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return ControlServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ControlServiceClient($options); + } + + /** @test */ + public function createControlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Control(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $control = new Control(); + $controlDisplayName = 'controlDisplayName-1438249776'; + $control->setDisplayName($controlDisplayName); + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $control->setSolutionType($controlSolutionType); + $controlId = 'controlId637416253'; + $request = (new CreateControlRequest()) + ->setParent($formattedParent) + ->setControl($control) + ->setControlId($controlId); + $response = $gapicClient->createControl($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1beta.ControlService/CreateControl', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getControl(); + $this->assertProtobufEquals($control, $actualValue); + $actualValue = $actualRequestObject->getControlId(); + $this->assertProtobufEquals($controlId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createControlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $control = new Control(); + $controlDisplayName = 'controlDisplayName-1438249776'; + $control->setDisplayName($controlDisplayName); + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $control->setSolutionType($controlSolutionType); + $controlId = 'controlId637416253'; + $request = (new CreateControlRequest()) + ->setParent($formattedParent) + ->setControl($control) + ->setControlId($controlId); + try { + $gapicClient->createControl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteControlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new GPBEmpty(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->controlName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[CONTROL]'); + $request = (new DeleteControlRequest())->setName($formattedName); + $gapicClient->deleteControl($request); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1beta.ControlService/DeleteControl', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function deleteControlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->controlName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[CONTROL]'); + $request = (new DeleteControlRequest())->setName($formattedName); + try { + $gapicClient->deleteControl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getControlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name2 = 'name2-1052831874'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Control(); + $expectedResponse->setName($name2); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedName = $gapicClient->controlName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[CONTROL]'); + $request = (new GetControlRequest())->setName($formattedName); + $response = $gapicClient->getControl($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1beta.ControlService/GetControl', $actualFuncCall); + $actualValue = $actualRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function getControlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->controlName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[CONTROL]'); + $request = (new GetControlRequest())->setName($formattedName); + try { + $gapicClient->getControl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listControlsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $nextPageToken = ''; + $controlsElement = new Control(); + $controls = [$controlsElement]; + $expectedResponse = new ListControlsResponse(); + $expectedResponse->setNextPageToken($nextPageToken); + $expectedResponse->setControls($controls); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $request = (new ListControlsRequest())->setParent($formattedParent); + $response = $gapicClient->listControls($request); + $this->assertEquals($expectedResponse, $response->getPage()->getResponseObject()); + $resources = iterator_to_array($response->iterateAllElements()); + $this->assertSame(1, count($resources)); + $this->assertEquals($expectedResponse->getControls()[0], $resources[0]); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1beta.ControlService/ListControls', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listControlsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $request = (new ListControlsRequest())->setParent($formattedParent); + try { + $gapicClient->listControls($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateControlTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Control(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $control = new Control(); + $controlDisplayName = 'controlDisplayName-1438249776'; + $control->setDisplayName($controlDisplayName); + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $control->setSolutionType($controlSolutionType); + $request = (new UpdateControlRequest())->setControl($control); + $response = $gapicClient->updateControl($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1beta.ControlService/UpdateControl', $actualFuncCall); + $actualValue = $actualRequestObject->getControl(); + $this->assertProtobufEquals($control, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function updateControlExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $control = new Control(); + $controlDisplayName = 'controlDisplayName-1438249776'; + $control->setDisplayName($controlDisplayName); + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $control->setSolutionType($controlSolutionType); + $request = (new UpdateControlRequest())->setControl($control); + try { + $gapicClient->updateControl($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function createControlAsyncTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $name = 'name3373707'; + $displayName = 'displayName1615086568'; + $expectedResponse = new Control(); + $expectedResponse->setName($name); + $expectedResponse->setDisplayName($displayName); + $transport->addResponse($expectedResponse); + // Mock request + $formattedParent = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $control = new Control(); + $controlDisplayName = 'controlDisplayName-1438249776'; + $control->setDisplayName($controlDisplayName); + $controlSolutionType = SolutionType::SOLUTION_TYPE_UNSPECIFIED; + $control->setSolutionType($controlSolutionType); + $controlId = 'controlId637416253'; + $request = (new CreateControlRequest()) + ->setParent($formattedParent) + ->setControl($control) + ->setControlId($controlId); + $response = $gapicClient->createControlAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1beta.ControlService/CreateControl', $actualFuncCall); + $actualValue = $actualRequestObject->getParent(); + $this->assertProtobufEquals($formattedParent, $actualValue); + $actualValue = $actualRequestObject->getControl(); + $this->assertProtobufEquals($control, $actualValue); + $actualValue = $actualRequestObject->getControlId(); + $this->assertProtobufEquals($controlId, $actualValue); + $this->assertTrue($transport->isExhausted()); + } +} diff --git a/DiscoveryEngine/tests/Unit/V1beta/Client/ConversationalSearchServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1beta/Client/ConversationalSearchServiceClientTest.php index d25fe7427d9f..e0122a775b3b 100644 --- a/DiscoveryEngine/tests/Unit/V1beta/Client/ConversationalSearchServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1beta/Client/ConversationalSearchServiceClientTest.php @@ -92,7 +92,9 @@ public function answerQueryTest() ]); $this->assertTrue($transport->isExhausted()); // Mock response + $answerQueryToken = 'answerQueryToken886927553'; $expectedResponse = new AnswerQueryResponse(); + $expectedResponse->setAnswerQueryToken($answerQueryToken); $transport->addResponse($expectedResponse); // Mock request $formattedServingConfig = $gapicClient->servingConfigName( @@ -1018,7 +1020,9 @@ public function answerQueryAsyncTest() ]); $this->assertTrue($transport->isExhausted()); // Mock response + $answerQueryToken = 'answerQueryToken886927553'; $expectedResponse = new AnswerQueryResponse(); + $expectedResponse->setAnswerQueryToken($answerQueryToken); $transport->addResponse($expectedResponse); // Mock request $formattedServingConfig = $gapicClient->servingConfigName( diff --git a/DiscoveryEngine/tests/Unit/V1beta/Client/DataStoreServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1beta/Client/DataStoreServiceClientTest.php index 3de6f5bd02aa..b5e31e2e2fbb 100644 --- a/DiscoveryEngine/tests/Unit/V1beta/Client/DataStoreServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1beta/Client/DataStoreServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1beta\Client\DataStoreServiceClient; @@ -35,6 +34,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\ListDataStoresRequest; use Google\Cloud\DiscoveryEngine\V1beta\ListDataStoresResponse; use Google\Cloud\DiscoveryEngine\V1beta\UpdateDataStoreRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; diff --git a/DiscoveryEngine/tests/Unit/V1beta/Client/DocumentServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1beta/Client/DocumentServiceClientTest.php index 567eacf9e98e..fdedafdb3fc8 100644 --- a/DiscoveryEngine/tests/Unit/V1beta/Client/DocumentServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1beta/Client/DocumentServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1beta\Client\DocumentServiceClient; @@ -39,6 +38,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\PurgeDocumentsRequest; use Google\Cloud\DiscoveryEngine\V1beta\PurgeDocumentsResponse; use Google\Cloud\DiscoveryEngine\V1beta\UpdateDocumentRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; diff --git a/DiscoveryEngine/tests/Unit/V1beta/Client/EngineServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1beta/Client/EngineServiceClientTest.php index b7ac06033c55..f0de60095118 100644 --- a/DiscoveryEngine/tests/Unit/V1beta/Client/EngineServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1beta/Client/EngineServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1beta\Client\EngineServiceClient; @@ -40,6 +39,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\TuneEngineRequest; use Google\Cloud\DiscoveryEngine\V1beta\TuneEngineResponse; use Google\Cloud\DiscoveryEngine\V1beta\UpdateEngineRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; diff --git a/DiscoveryEngine/tests/Unit/V1beta/Client/ProjectServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1beta/Client/ProjectServiceClientTest.php new file mode 100644 index 000000000000..76c46d924b05 --- /dev/null +++ b/DiscoveryEngine/tests/Unit/V1beta/Client/ProjectServiceClientTest.php @@ -0,0 +1,280 @@ +getMockBuilder(CredentialsWrapper::class) + ->disableOriginalConstructor() + ->getMock(); + } + + /** @return ProjectServiceClient */ + private function createClient(array $options = []) + { + $options += [ + 'credentials' => $this->createCredentials(), + ]; + return new ProjectServiceClient($options); + } + + /** @test */ + public function provisionProjectTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/provisionProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new Project(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/provisionProjectTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $acceptDataUseTerms = false; + $dataUseTermsVersion = 'dataUseTermsVersion1209366547'; + $request = (new ProvisionProjectRequest()) + ->setName($formattedName) + ->setAcceptDataUseTerms($acceptDataUseTerms) + ->setDataUseTermsVersion($dataUseTermsVersion); + $response = $gapicClient->provisionProject($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1beta.ProjectService/ProvisionProject', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getAcceptDataUseTerms(); + $this->assertProtobufEquals($acceptDataUseTerms, $actualValue); + $actualValue = $actualApiRequestObject->getDataUseTermsVersion(); + $this->assertProtobufEquals($dataUseTermsVersion, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/provisionProjectTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function provisionProjectExceptionTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/provisionProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $operationsTransport->addResponse(null, $status); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $acceptDataUseTerms = false; + $dataUseTermsVersion = 'dataUseTermsVersion1209366547'; + $request = (new ProvisionProjectRequest()) + ->setName($formattedName) + ->setAcceptDataUseTerms($acceptDataUseTerms) + ->setDataUseTermsVersion($dataUseTermsVersion); + $response = $gapicClient->provisionProject($request); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/provisionProjectTest'); + try { + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + // If the pollUntilComplete() method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stubs are exhausted + $transport->popReceivedCalls(); + $operationsTransport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } + + /** @test */ + public function provisionProjectAsyncTest() + { + $operationsTransport = $this->createTransport(); + $operationsClient = new OperationsClient([ + 'apiEndpoint' => '', + 'transport' => $operationsTransport, + 'credentials' => $this->createCredentials(), + ]); + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + 'operationsClient' => $operationsClient, + ]); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + // Mock response + $incompleteOperation = new Operation(); + $incompleteOperation->setName('operations/provisionProjectTest'); + $incompleteOperation->setDone(false); + $transport->addResponse($incompleteOperation); + $name2 = 'name2-1052831874'; + $expectedResponse = new Project(); + $expectedResponse->setName($name2); + $anyResponse = new Any(); + $anyResponse->setValue($expectedResponse->serializeToString()); + $completeOperation = new Operation(); + $completeOperation->setName('operations/provisionProjectTest'); + $completeOperation->setDone(true); + $completeOperation->setResponse($anyResponse); + $operationsTransport->addResponse($completeOperation); + // Mock request + $formattedName = $gapicClient->projectName('[PROJECT]'); + $acceptDataUseTerms = false; + $dataUseTermsVersion = 'dataUseTermsVersion1209366547'; + $request = (new ProvisionProjectRequest()) + ->setName($formattedName) + ->setAcceptDataUseTerms($acceptDataUseTerms) + ->setDataUseTermsVersion($dataUseTermsVersion); + $response = $gapicClient->provisionProjectAsync($request)->wait(); + $this->assertFalse($response->isDone()); + $this->assertNull($response->getResult()); + $apiRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($apiRequests)); + $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); + $this->assertSame(0, count($operationsRequestsEmpty)); + $actualApiFuncCall = $apiRequests[0]->getFuncCall(); + $actualApiRequestObject = $apiRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1beta.ProjectService/ProvisionProject', $actualApiFuncCall); + $actualValue = $actualApiRequestObject->getName(); + $this->assertProtobufEquals($formattedName, $actualValue); + $actualValue = $actualApiRequestObject->getAcceptDataUseTerms(); + $this->assertProtobufEquals($acceptDataUseTerms, $actualValue); + $actualValue = $actualApiRequestObject->getDataUseTermsVersion(); + $this->assertProtobufEquals($dataUseTermsVersion, $actualValue); + $expectedOperationsRequestObject = new GetOperationRequest(); + $expectedOperationsRequestObject->setName('operations/provisionProjectTest'); + $response->pollUntilComplete([ + 'initialPollDelayMillis' => 1, + ]); + $this->assertTrue($response->isDone()); + $this->assertEquals($expectedResponse, $response->getResult()); + $apiRequestsEmpty = $transport->popReceivedCalls(); + $this->assertSame(0, count($apiRequestsEmpty)); + $operationsRequests = $operationsTransport->popReceivedCalls(); + $this->assertSame(1, count($operationsRequests)); + $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); + $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); + $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); + $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); + $this->assertTrue($transport->isExhausted()); + $this->assertTrue($operationsTransport->isExhausted()); + } +} diff --git a/DiscoveryEngine/tests/Unit/V1beta/Client/SchemaServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1beta/Client/SchemaServiceClientTest.php index bbab542ccb72..93186dcfd002 100644 --- a/DiscoveryEngine/tests/Unit/V1beta/Client/SchemaServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1beta/Client/SchemaServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1beta\Client\SchemaServiceClient; @@ -35,6 +34,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\ListSchemasResponse; use Google\Cloud\DiscoveryEngine\V1beta\Schema; use Google\Cloud\DiscoveryEngine\V1beta\UpdateSchemaRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; diff --git a/DiscoveryEngine/tests/Unit/V1beta/Client/SearchTuningServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1beta/Client/SearchTuningServiceClientTest.php index 5d2545431d7c..9dab759e9b6a 100644 --- a/DiscoveryEngine/tests/Unit/V1beta/Client/SearchTuningServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1beta/Client/SearchTuningServiceClientTest.php @@ -24,12 +24,14 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1beta\Client\SearchTuningServiceClient; +use Google\Cloud\DiscoveryEngine\V1beta\ListCustomModelsRequest; +use Google\Cloud\DiscoveryEngine\V1beta\ListCustomModelsResponse; use Google\Cloud\DiscoveryEngine\V1beta\TrainCustomModelRequest; use Google\Cloud\DiscoveryEngine\V1beta\TrainCustomModelResponse; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; @@ -66,6 +68,69 @@ private function createClient(array $options = []) return new SearchTuningServiceClient($options); } + /** @test */ + public function listCustomModelsTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + // Mock response + $expectedResponse = new ListCustomModelsResponse(); + $transport->addResponse($expectedResponse); + // Mock request + $formattedDataStore = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $request = (new ListCustomModelsRequest())->setDataStore($formattedDataStore); + $response = $gapicClient->listCustomModels($request); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1beta.SearchTuningService/ListCustomModels', $actualFuncCall); + $actualValue = $actualRequestObject->getDataStore(); + $this->assertProtobufEquals($formattedDataStore, $actualValue); + $this->assertTrue($transport->isExhausted()); + } + + /** @test */ + public function listCustomModelsExceptionTest() + { + $transport = $this->createTransport(); + $gapicClient = $this->createClient([ + 'transport' => $transport, + ]); + $this->assertTrue($transport->isExhausted()); + $status = new stdClass(); + $status->code = Code::DATA_LOSS; + $status->details = 'internal error'; + $expectedExceptionMessage = json_encode( + [ + 'message' => 'internal error', + 'code' => Code::DATA_LOSS, + 'status' => 'DATA_LOSS', + 'details' => [], + ], + JSON_PRETTY_PRINT + ); + $transport->addResponse(null, $status); + // Mock request + $formattedDataStore = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); + $request = (new ListCustomModelsRequest())->setDataStore($formattedDataStore); + try { + $gapicClient->listCustomModels($request); + // If the $gapicClient method call did not throw, fail the test + $this->fail('Expected an ApiException, but no exception was thrown.'); + } catch (ApiException $ex) { + $this->assertEquals($status->code, $ex->getCode()); + $this->assertEquals($expectedExceptionMessage, $ex->getMessage()); + } + // Call popReceivedCalls to ensure the stub is exhausted + $transport->popReceivedCalls(); + $this->assertTrue($transport->isExhausted()); + } + /** @test */ public function trainCustomModelTest() { @@ -88,8 +153,10 @@ public function trainCustomModelTest() $incompleteOperation->setDone(false); $transport->addResponse($incompleteOperation); $modelStatus = 'modelStatus12165576'; + $modelName = 'modelName2104871393'; $expectedResponse = new TrainCustomModelResponse(); $expectedResponse->setModelStatus($modelStatus); + $expectedResponse->setModelName($modelName); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -194,70 +261,28 @@ public function trainCustomModelExceptionTest() } /** @test */ - public function trainCustomModelAsyncTest() + public function listCustomModelsAsyncTest() { - $operationsTransport = $this->createTransport(); - $operationsClient = new OperationsClient([ - 'apiEndpoint' => '', - 'transport' => $operationsTransport, - 'credentials' => $this->createCredentials(), - ]); $transport = $this->createTransport(); $gapicClient = $this->createClient([ 'transport' => $transport, - 'operationsClient' => $operationsClient, ]); $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); // Mock response - $incompleteOperation = new Operation(); - $incompleteOperation->setName('operations/trainCustomModelTest'); - $incompleteOperation->setDone(false); - $transport->addResponse($incompleteOperation); - $modelStatus = 'modelStatus12165576'; - $expectedResponse = new TrainCustomModelResponse(); - $expectedResponse->setModelStatus($modelStatus); - $anyResponse = new Any(); - $anyResponse->setValue($expectedResponse->serializeToString()); - $completeOperation = new Operation(); - $completeOperation->setName('operations/trainCustomModelTest'); - $completeOperation->setDone(true); - $completeOperation->setResponse($anyResponse); - $operationsTransport->addResponse($completeOperation); + $expectedResponse = new ListCustomModelsResponse(); + $transport->addResponse($expectedResponse); // Mock request $formattedDataStore = $gapicClient->dataStoreName('[PROJECT]', '[LOCATION]', '[DATA_STORE]'); - $request = (new TrainCustomModelRequest())->setDataStore($formattedDataStore); - $response = $gapicClient->trainCustomModelAsync($request)->wait(); - $this->assertFalse($response->isDone()); - $this->assertNull($response->getResult()); - $apiRequests = $transport->popReceivedCalls(); - $this->assertSame(1, count($apiRequests)); - $operationsRequestsEmpty = $operationsTransport->popReceivedCalls(); - $this->assertSame(0, count($operationsRequestsEmpty)); - $actualApiFuncCall = $apiRequests[0]->getFuncCall(); - $actualApiRequestObject = $apiRequests[0]->getRequestObject(); - $this->assertSame( - '/google.cloud.discoveryengine.v1beta.SearchTuningService/TrainCustomModel', - $actualApiFuncCall - ); - $actualValue = $actualApiRequestObject->getDataStore(); + $request = (new ListCustomModelsRequest())->setDataStore($formattedDataStore); + $response = $gapicClient->listCustomModelsAsync($request)->wait(); + $this->assertEquals($expectedResponse, $response); + $actualRequests = $transport->popReceivedCalls(); + $this->assertSame(1, count($actualRequests)); + $actualFuncCall = $actualRequests[0]->getFuncCall(); + $actualRequestObject = $actualRequests[0]->getRequestObject(); + $this->assertSame('/google.cloud.discoveryengine.v1beta.SearchTuningService/ListCustomModels', $actualFuncCall); + $actualValue = $actualRequestObject->getDataStore(); $this->assertProtobufEquals($formattedDataStore, $actualValue); - $expectedOperationsRequestObject = new GetOperationRequest(); - $expectedOperationsRequestObject->setName('operations/trainCustomModelTest'); - $response->pollUntilComplete([ - 'initialPollDelayMillis' => 1, - ]); - $this->assertTrue($response->isDone()); - $this->assertEquals($expectedResponse, $response->getResult()); - $apiRequestsEmpty = $transport->popReceivedCalls(); - $this->assertSame(0, count($apiRequestsEmpty)); - $operationsRequests = $operationsTransport->popReceivedCalls(); - $this->assertSame(1, count($operationsRequests)); - $actualOperationsFuncCall = $operationsRequests[0]->getFuncCall(); - $actualOperationsRequestObject = $operationsRequests[0]->getRequestObject(); - $this->assertSame('/google.longrunning.Operations/GetOperation', $actualOperationsFuncCall); - $this->assertEquals($expectedOperationsRequestObject, $actualOperationsRequestObject); $this->assertTrue($transport->isExhausted()); - $this->assertTrue($operationsTransport->isExhausted()); } } diff --git a/DiscoveryEngine/tests/Unit/V1beta/Client/SiteSearchEngineServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1beta/Client/SiteSearchEngineServiceClientTest.php index 7b0a010dba77..4658ab1723ff 100644 --- a/DiscoveryEngine/tests/Unit/V1beta/Client/SiteSearchEngineServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1beta/Client/SiteSearchEngineServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Cloud\DiscoveryEngine\V1beta\BatchCreateTargetSitesRequest; @@ -49,6 +48,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\SiteSearchEngine; use Google\Cloud\DiscoveryEngine\V1beta\TargetSite; use Google\Cloud\DiscoveryEngine\V1beta\UpdateTargetSiteRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; @@ -365,11 +365,13 @@ public function createTargetSiteTest() $providedUriPattern = 'providedUriPattern437506913'; $exactMatch = false; $generatedUriPattern = 'generatedUriPattern-1580317427'; + $rootDomainUri = 'rootDomainUri-789734674'; $expectedResponse = new TargetSite(); $expectedResponse->setName($name); $expectedResponse->setProvidedUriPattern($providedUriPattern); $expectedResponse->setExactMatch($exactMatch); $expectedResponse->setGeneratedUriPattern($generatedUriPattern); + $expectedResponse->setRootDomainUri($rootDomainUri); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); @@ -1013,11 +1015,13 @@ public function getTargetSiteTest() $providedUriPattern = 'providedUriPattern437506913'; $exactMatch = false; $generatedUriPattern = 'generatedUriPattern-1580317427'; + $rootDomainUri = 'rootDomainUri-789734674'; $expectedResponse = new TargetSite(); $expectedResponse->setName($name2); $expectedResponse->setProvidedUriPattern($providedUriPattern); $expectedResponse->setExactMatch($exactMatch); $expectedResponse->setGeneratedUriPattern($generatedUriPattern); + $expectedResponse->setRootDomainUri($rootDomainUri); $transport->addResponse($expectedResponse); // Mock request $formattedName = $gapicClient->targetSiteName('[PROJECT]', '[LOCATION]', '[DATA_STORE]', '[TARGET_SITE]'); @@ -1304,11 +1308,13 @@ public function updateTargetSiteTest() $providedUriPattern = 'providedUriPattern437506913'; $exactMatch = false; $generatedUriPattern = 'generatedUriPattern-1580317427'; + $rootDomainUri = 'rootDomainUri-789734674'; $expectedResponse = new TargetSite(); $expectedResponse->setName($name); $expectedResponse->setProvidedUriPattern($providedUriPattern); $expectedResponse->setExactMatch($exactMatch); $expectedResponse->setGeneratedUriPattern($generatedUriPattern); + $expectedResponse->setRootDomainUri($rootDomainUri); $anyResponse = new Any(); $anyResponse->setValue($expectedResponse->serializeToString()); $completeOperation = new Operation(); diff --git a/DiscoveryEngine/tests/Unit/V1beta/Client/UserEventServiceClientTest.php b/DiscoveryEngine/tests/Unit/V1beta/Client/UserEventServiceClientTest.php index 8574c7779b97..4496bf3a5288 100644 --- a/DiscoveryEngine/tests/Unit/V1beta/Client/UserEventServiceClientTest.php +++ b/DiscoveryEngine/tests/Unit/V1beta/Client/UserEventServiceClientTest.php @@ -24,7 +24,6 @@ use Google\ApiCore\ApiException; use Google\ApiCore\CredentialsWrapper; -use Google\ApiCore\LongRunning\OperationsClient; use Google\ApiCore\Testing\GeneratedTest; use Google\ApiCore\Testing\MockTransport; use Google\Api\HttpBody; @@ -34,6 +33,7 @@ use Google\Cloud\DiscoveryEngine\V1beta\ImportUserEventsResponse; use Google\Cloud\DiscoveryEngine\V1beta\UserEvent; use Google\Cloud\DiscoveryEngine\V1beta\WriteUserEventRequest; +use Google\LongRunning\Client\OperationsClient; use Google\LongRunning\GetOperationRequest; use Google\LongRunning\Operation; use Google\Protobuf\Any; @@ -278,6 +278,8 @@ public function writeUserEventTest() // Mock response $eventType = 'eventType984376767'; $userPseudoId = 'userPseudoId-1850666040'; + $engine = 'engine-1298662846'; + $dataStore = 'dataStore1619682316'; $directUserRequest = false; $sessionId = 'sessionId1661853540'; $attributionToken = 'attributionToken-729411015'; @@ -285,6 +287,8 @@ public function writeUserEventTest() $expectedResponse = new UserEvent(); $expectedResponse->setEventType($eventType); $expectedResponse->setUserPseudoId($userPseudoId); + $expectedResponse->setEngine($engine); + $expectedResponse->setDataStore($dataStore); $expectedResponse->setDirectUserRequest($directUserRequest); $expectedResponse->setSessionId($sessionId); $expectedResponse->setAttributionToken($attributionToken);