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\GoogleCloudDialogflowCxV3Intent;
21use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ListIntentsResponse;
22use Google\Service\Dialogflow\GoogleProtobufEmpty;
23
24/**
25 * The "intents" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $dialogflowService = new Google\Service\Dialogflow(...);
29 *   $intents = $dialogflowService->intents;
30 *  </code>
31 */
32class ProjectsLocationsAgentsIntents extends \Google\Service\Resource
33{
34  /**
35   * Creates an intent in the specified agent. Note: You should always train a
36   * flow prior to sending it queries. See the [training
37   * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
38   * (intents.create)
39   *
40   * @param string $parent Required. The agent to create an intent for. Format:
41   * `projects//locations//agents/`.
42   * @param GoogleCloudDialogflowCxV3Intent $postBody
43   * @param array $optParams Optional parameters.
44   *
45   * @opt_param string languageCode The language of the following fields in
46   * `intent`: * `Intent.training_phrases.parts.text` If not specified, the
47   * agent's default language is used. [Many
48   * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
49   * are supported. Note: languages must be enabled in the agent before they can
50   * be used.
51   * @return GoogleCloudDialogflowCxV3Intent
52   */
53  public function create($parent, GoogleCloudDialogflowCxV3Intent $postBody, $optParams = [])
54  {
55    $params = ['parent' => $parent, 'postBody' => $postBody];
56    $params = array_merge($params, $optParams);
57    return $this->call('create', [$params], GoogleCloudDialogflowCxV3Intent::class);
58  }
59  /**
60   * Deletes the specified intent. Note: You should always train a flow prior to
61   * sending it queries. See the [training
62   * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
63   * (intents.delete)
64   *
65   * @param string $name Required. The name of the intent to delete. Format:
66   * `projects//locations//agents//intents/`.
67   * @param array $optParams Optional parameters.
68   * @return GoogleProtobufEmpty
69   */
70  public function delete($name, $optParams = [])
71  {
72    $params = ['name' => $name];
73    $params = array_merge($params, $optParams);
74    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
75  }
76  /**
77   * Retrieves the specified intent. (intents.get)
78   *
79   * @param string $name Required. The name of the intent. Format:
80   * `projects//locations//agents//intents/`.
81   * @param array $optParams Optional parameters.
82   *
83   * @opt_param string languageCode The language to retrieve the intent for. The
84   * following fields are language dependent: *
85   * `Intent.training_phrases.parts.text` If not specified, the agent's default
86   * language is used. [Many
87   * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
88   * are supported. Note: languages must be enabled in the agent before they can
89   * be used.
90   * @return GoogleCloudDialogflowCxV3Intent
91   */
92  public function get($name, $optParams = [])
93  {
94    $params = ['name' => $name];
95    $params = array_merge($params, $optParams);
96    return $this->call('get', [$params], GoogleCloudDialogflowCxV3Intent::class);
97  }
98  /**
99   * Returns the list of all intents in the specified agent.
100   * (intents.listProjectsLocationsAgentsIntents)
101   *
102   * @param string $parent Required. The agent to list all intents for. Format:
103   * `projects//locations//agents/`.
104   * @param array $optParams Optional parameters.
105   *
106   * @opt_param string intentView The resource view to apply to the returned
107   * intent.
108   * @opt_param string languageCode The language to list intents for. The
109   * following fields are language dependent: *
110   * `Intent.training_phrases.parts.text` If not specified, the agent's default
111   * language is used. [Many
112   * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
113   * are supported. Note: languages must be enabled in the agent before they can
114   * be used.
115   * @opt_param int pageSize The maximum number of items to return in a single
116   * page. By default 100 and at most 1000.
117   * @opt_param string pageToken The next_page_token value returned from a
118   * previous list request.
119   * @return GoogleCloudDialogflowCxV3ListIntentsResponse
120   */
121  public function listProjectsLocationsAgentsIntents($parent, $optParams = [])
122  {
123    $params = ['parent' => $parent];
124    $params = array_merge($params, $optParams);
125    return $this->call('list', [$params], GoogleCloudDialogflowCxV3ListIntentsResponse::class);
126  }
127  /**
128   * Updates the specified intent. Note: You should always train a flow prior to
129   * sending it queries. See the [training
130   * documentation](https://cloud.google.com/dialogflow/cx/docs/concept/training).
131   * (intents.patch)
132   *
133   * @param string $name The unique identifier of the intent. Required for the
134   * Intents.UpdateIntent method. Intents.CreateIntent populates the name
135   * automatically. Format: `projects//locations//agents//intents/`.
136   * @param GoogleCloudDialogflowCxV3Intent $postBody
137   * @param array $optParams Optional parameters.
138   *
139   * @opt_param string languageCode The language of the following fields in
140   * `intent`: * `Intent.training_phrases.parts.text` If not specified, the
141   * agent's default language is used. [Many
142   * languages](https://cloud.google.com/dialogflow/cx/docs/reference/language)
143   * are supported. Note: languages must be enabled in the agent before they can
144   * be used.
145   * @opt_param string updateMask The mask to control which fields get updated. If
146   * the mask is not present, all fields will be updated.
147   * @return GoogleCloudDialogflowCxV3Intent
148   */
149  public function patch($name, GoogleCloudDialogflowCxV3Intent $postBody, $optParams = [])
150  {
151    $params = ['name' => $name, 'postBody' => $postBody];
152    $params = array_merge($params, $optParams);
153    return $this->call('patch', [$params], GoogleCloudDialogflowCxV3Intent::class);
154  }
155}
156
157// Adding a class alias for backwards compatibility with the previous class name.
158class_alias(ProjectsLocationsAgentsIntents::class, 'Google_Service_Dialogflow_Resource_ProjectsLocationsAgentsIntents');
159