1<?php 2/* 3 * Copyright 2014 Google Inc. 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); you may not 6 * use this file except in compliance with the License. You may obtain a copy of 7 * the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 14 * License for the specific language governing permissions and limitations under 15 * the License. 16 */ 17 18namespace Google\Service\Dialogflow\Resource; 19 20use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3EntityType; 21use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ListEntityTypesResponse; 22use Google\Service\Dialogflow\GoogleProtobufEmpty; 23 24/** 25 * The "entityTypes" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $dialogflowService = new Google\Service\Dialogflow(...); 29 * $entityTypes = $dialogflowService->entityTypes; 30 * </code> 31 */ 32class ProjectsLocationsAgentsEntityTypes extends \Google\Service\Resource 33{ 34 /** 35 * Creates an entity type in the specified agent. Note: You should always train 36 * a flow prior to sending it queries. See the [training 37 * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 38 * (entityTypes.create) 39 * 40 * @param string $parent Required. The agent to create a entity type for. 41 * Format: `projects//locations//agents/`. 42 * @param GoogleCloudDialogflowCxV3EntityType $postBody 43 * @param array $optParams Optional parameters. 44 * 45 * @opt_param string languageCode The language of the following fields in 46 * `entity_type`: * `EntityType.entities.value` * `EntityType.entities.synonyms` 47 * * `EntityType.excluded_phrases.value` If not specified, the agent's default 48 * language is used. [Many 49 * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 50 * are supported. Note: languages must be enabled in the agent before they can 51 * be used. 52 * @return GoogleCloudDialogflowCxV3EntityType 53 */ 54 public function create($parent, GoogleCloudDialogflowCxV3EntityType $postBody, $optParams = []) 55 { 56 $params = ['parent' => $parent, 'postBody' => $postBody]; 57 $params = array_merge($params, $optParams); 58 return $this->call('create', [$params], GoogleCloudDialogflowCxV3EntityType::class); 59 } 60 /** 61 * Deletes the specified entity type. Note: You should always train a flow prior 62 * to sending it queries. See the [training 63 * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 64 * (entityTypes.delete) 65 * 66 * @param string $name Required. The name of the entity type to delete. Format: 67 * `projects//locations//agents//entityTypes/`. 68 * @param array $optParams Optional parameters. 69 * 70 * @opt_param bool force This field has no effect for entity type not being 71 * used. For entity types that are used by intents or pages: * If `force` is set 72 * to false, an error will be returned with message indicating the referencing 73 * resources. * If `force` is set to true, Dialogflow will remove the entity 74 * type, as well as any references to the entity type (i.e. Page parameter of 75 * the entity type will be changed to '@sys.any' and intent parameter of the 76 * entity type will be removed). 77 * @return GoogleProtobufEmpty 78 */ 79 public function delete($name, $optParams = []) 80 { 81 $params = ['name' => $name]; 82 $params = array_merge($params, $optParams); 83 return $this->call('delete', [$params], GoogleProtobufEmpty::class); 84 } 85 /** 86 * Retrieves the specified entity type. (entityTypes.get) 87 * 88 * @param string $name Required. The name of the entity type. Format: 89 * `projects//locations//agents//entityTypes/`. 90 * @param array $optParams Optional parameters. 91 * 92 * @opt_param string languageCode The language to retrieve the entity type for. 93 * The following fields are language dependent: * `EntityType.entities.value` * 94 * `EntityType.entities.synonyms` * `EntityType.excluded_phrases.value` If not 95 * specified, the agent's default language is used. [Many 96 * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 97 * are supported. Note: languages must be enabled in the agent before they can 98 * be used. 99 * @return GoogleCloudDialogflowCxV3EntityType 100 */ 101 public function get($name, $optParams = []) 102 { 103 $params = ['name' => $name]; 104 $params = array_merge($params, $optParams); 105 return $this->call('get', [$params], GoogleCloudDialogflowCxV3EntityType::class); 106 } 107 /** 108 * Returns the list of all entity types in the specified agent. 109 * (entityTypes.listProjectsLocationsAgentsEntityTypes) 110 * 111 * @param string $parent Required. The agent to list all entity types for. 112 * Format: `projects//locations//agents/`. 113 * @param array $optParams Optional parameters. 114 * 115 * @opt_param string languageCode The language to list entity types for. The 116 * following fields are language dependent: * `EntityType.entities.value` * 117 * `EntityType.entities.synonyms` * `EntityType.excluded_phrases.value` If not 118 * specified, the agent's default language is used. [Many 119 * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 120 * are supported. Note: languages must be enabled in the agent before they can 121 * be used. 122 * @opt_param int pageSize The maximum number of items to return in a single 123 * page. By default 100 and at most 1000. 124 * @opt_param string pageToken The next_page_token value returned from a 125 * previous list request. 126 * @return GoogleCloudDialogflowCxV3ListEntityTypesResponse 127 */ 128 public function listProjectsLocationsAgentsEntityTypes($parent, $optParams = []) 129 { 130 $params = ['parent' => $parent]; 131 $params = array_merge($params, $optParams); 132 return $this->call('list', [$params], GoogleCloudDialogflowCxV3ListEntityTypesResponse::class); 133 } 134 /** 135 * Updates the specified entity type. Note: You should always train a flow prior 136 * to sending it queries. See the [training 137 * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training). 138 * (entityTypes.patch) 139 * 140 * @param string $name The unique identifier of the entity type. Required for 141 * EntityTypes.UpdateEntityType. Format: 142 * `projects//locations//agents//entityTypes/`. 143 * @param GoogleCloudDialogflowCxV3EntityType $postBody 144 * @param array $optParams Optional parameters. 145 * 146 * @opt_param string languageCode The language of the following fields in 147 * `entity_type`: * `EntityType.entities.value` * `EntityType.entities.synonyms` 148 * * `EntityType.excluded_phrases.value` If not specified, the agent's default 149 * language is used. [Many 150 * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language) 151 * are supported. Note: languages must be enabled in the agent before they can 152 * be used. 153 * @opt_param string updateMask The mask to control which fields get updated. 154 * @return GoogleCloudDialogflowCxV3EntityType 155 */ 156 public function patch($name, GoogleCloudDialogflowCxV3EntityType $postBody, $optParams = []) 157 { 158 $params = ['name' => $name, 'postBody' => $postBody]; 159 $params = array_merge($params, $optParams); 160 return $this->call('patch', [$params], GoogleCloudDialogflowCxV3EntityType::class); 161 } 162} 163 164// Adding a class alias for backwards compatibility with the previous class name. 165class_alias(ProjectsLocationsAgentsEntityTypes::class, 'Google_Service_Dialogflow_Resource_ProjectsLocationsAgentsEntityTypes'); 166