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 |
|
---|
18 | namespace Google\Service\Dialogflow\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3AnswerFeedback;
|
---|
21 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3DetectIntentRequest;
|
---|
22 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3DetectIntentResponse;
|
---|
23 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3FulfillIntentRequest;
|
---|
24 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3FulfillIntentResponse;
|
---|
25 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3MatchIntentRequest;
|
---|
26 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3MatchIntentResponse;
|
---|
27 | use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3SubmitAnswerFeedbackRequest;
|
---|
28 |
|
---|
29 | /**
|
---|
30 | * The "sessions" collection of methods.
|
---|
31 | * Typical usage is:
|
---|
32 | * <code>
|
---|
33 | * $dialogflowService = new Google\Service\Dialogflow(...);
|
---|
34 | * $sessions = $dialogflowService->projects_locations_agents_sessions;
|
---|
35 | * </code>
|
---|
36 | */
|
---|
37 | class ProjectsLocationsAgentsSessions extends \Google\Service\Resource
|
---|
38 | {
|
---|
39 | /**
|
---|
40 | * Processes a natural language query and returns structured, actionable data as
|
---|
41 | * a result. This method is not idempotent, because it may cause session entity
|
---|
42 | * types to be updated, which in turn might affect results of future queries.
|
---|
43 | * Note: Always use agent versions for production traffic. See [Versions and
|
---|
44 | * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
|
---|
45 | * (sessions.detectIntent)
|
---|
46 | *
|
---|
47 | * @param string $session Required. The name of the session this query is sent
|
---|
48 | * to. Format: `projects//locations//agents//sessions/` or
|
---|
49 | * `projects//locations//agents//environments//sessions/`. If `Environment ID`
|
---|
50 | * is not specified, we assume default 'draft' environment. It's up to the API
|
---|
51 | * caller to choose an appropriate `Session ID`. It can be a random number or
|
---|
52 | * some type of session identifiers (preferably hashed). The length of the
|
---|
53 | * `Session ID` must not exceed 36 characters. For more information, see the
|
---|
54 | * [sessions
|
---|
55 | * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). Note:
|
---|
56 | * Always use agent versions for production traffic. See [Versions and
|
---|
57 | * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
|
---|
58 | * @param GoogleCloudDialogflowCxV3DetectIntentRequest $postBody
|
---|
59 | * @param array $optParams Optional parameters.
|
---|
60 | * @return GoogleCloudDialogflowCxV3DetectIntentResponse
|
---|
61 | * @throws \Google\Service\Exception
|
---|
62 | */
|
---|
63 | public function detectIntent($session, GoogleCloudDialogflowCxV3DetectIntentRequest $postBody, $optParams = [])
|
---|
64 | {
|
---|
65 | $params = ['session' => $session, 'postBody' => $postBody];
|
---|
66 | $params = array_merge($params, $optParams);
|
---|
67 | return $this->call('detectIntent', [$params], GoogleCloudDialogflowCxV3DetectIntentResponse::class);
|
---|
68 | }
|
---|
69 | /**
|
---|
70 | * Fulfills a matched intent returned by MatchIntent. Must be called after
|
---|
71 | * MatchIntent, with input from MatchIntentResponse. Otherwise, the behavior is
|
---|
72 | * undefined. (sessions.fulfillIntent)
|
---|
73 | *
|
---|
74 | * @param string $session Required. The name of the session this query is sent
|
---|
75 | * to. Format: `projects//locations//agents//sessions/` or
|
---|
76 | * `projects//locations//agents//environments//sessions/`. If `Environment ID`
|
---|
77 | * is not specified, we assume default 'draft' environment. It's up to the API
|
---|
78 | * caller to choose an appropriate `Session ID`. It can be a random number or
|
---|
79 | * some type of session identifiers (preferably hashed). The length of the
|
---|
80 | * `Session ID` must not exceed 36 characters. For more information, see the
|
---|
81 | * [sessions
|
---|
82 | * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
|
---|
83 | * @param GoogleCloudDialogflowCxV3FulfillIntentRequest $postBody
|
---|
84 | * @param array $optParams Optional parameters.
|
---|
85 | * @return GoogleCloudDialogflowCxV3FulfillIntentResponse
|
---|
86 | * @throws \Google\Service\Exception
|
---|
87 | */
|
---|
88 | public function fulfillIntent($session, GoogleCloudDialogflowCxV3FulfillIntentRequest $postBody, $optParams = [])
|
---|
89 | {
|
---|
90 | $params = ['session' => $session, 'postBody' => $postBody];
|
---|
91 | $params = array_merge($params, $optParams);
|
---|
92 | return $this->call('fulfillIntent', [$params], GoogleCloudDialogflowCxV3FulfillIntentResponse::class);
|
---|
93 | }
|
---|
94 | /**
|
---|
95 | * Returns preliminary intent match results, doesn't change the session status.
|
---|
96 | * (sessions.matchIntent)
|
---|
97 | *
|
---|
98 | * @param string $session Required. The name of the session this query is sent
|
---|
99 | * to. Format: `projects//locations//agents//sessions/` or
|
---|
100 | * `projects//locations//agents//environments//sessions/`. If `Environment ID`
|
---|
101 | * is not specified, we assume default 'draft' environment. It's up to the API
|
---|
102 | * caller to choose an appropriate `Session ID`. It can be a random number or
|
---|
103 | * some type of session identifiers (preferably hashed). The length of the
|
---|
104 | * `Session ID` must not exceed 36 characters. For more information, see the
|
---|
105 | * [sessions
|
---|
106 | * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
|
---|
107 | * @param GoogleCloudDialogflowCxV3MatchIntentRequest $postBody
|
---|
108 | * @param array $optParams Optional parameters.
|
---|
109 | * @return GoogleCloudDialogflowCxV3MatchIntentResponse
|
---|
110 | * @throws \Google\Service\Exception
|
---|
111 | */
|
---|
112 | public function matchIntent($session, GoogleCloudDialogflowCxV3MatchIntentRequest $postBody, $optParams = [])
|
---|
113 | {
|
---|
114 | $params = ['session' => $session, 'postBody' => $postBody];
|
---|
115 | $params = array_merge($params, $optParams);
|
---|
116 | return $this->call('matchIntent', [$params], GoogleCloudDialogflowCxV3MatchIntentResponse::class);
|
---|
117 | }
|
---|
118 | /**
|
---|
119 | * Processes a natural language query and returns structured, actionable data as
|
---|
120 | * a result through server-side streaming. Server-side streaming allows
|
---|
121 | * Dialogflow to send [partial responses](https://cloud.google.com/dialogflow/cx
|
---|
122 | * /docs/concept/fulfillment#partial-response) earlier in a single request.
|
---|
123 | * (sessions.serverStreamingDetectIntent)
|
---|
124 | *
|
---|
125 | * @param string $session Required. The name of the session this query is sent
|
---|
126 | * to. Format: `projects//locations//agents//sessions/` or
|
---|
127 | * `projects//locations//agents//environments//sessions/`. If `Environment ID`
|
---|
128 | * is not specified, we assume default 'draft' environment. It's up to the API
|
---|
129 | * caller to choose an appropriate `Session ID`. It can be a random number or
|
---|
130 | * some type of session identifiers (preferably hashed). The length of the
|
---|
131 | * `Session ID` must not exceed 36 characters. For more information, see the
|
---|
132 | * [sessions
|
---|
133 | * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). Note:
|
---|
134 | * Always use agent versions for production traffic. See [Versions and
|
---|
135 | * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
|
---|
136 | * @param GoogleCloudDialogflowCxV3DetectIntentRequest $postBody
|
---|
137 | * @param array $optParams Optional parameters.
|
---|
138 | * @return GoogleCloudDialogflowCxV3DetectIntentResponse
|
---|
139 | * @throws \Google\Service\Exception
|
---|
140 | */
|
---|
141 | public function serverStreamingDetectIntent($session, GoogleCloudDialogflowCxV3DetectIntentRequest $postBody, $optParams = [])
|
---|
142 | {
|
---|
143 | $params = ['session' => $session, 'postBody' => $postBody];
|
---|
144 | $params = array_merge($params, $optParams);
|
---|
145 | return $this->call('serverStreamingDetectIntent', [$params], GoogleCloudDialogflowCxV3DetectIntentResponse::class);
|
---|
146 | }
|
---|
147 | /**
|
---|
148 | * Updates the feedback received from the user for a single turn of the bot
|
---|
149 | * response. (sessions.submitAnswerFeedback)
|
---|
150 | *
|
---|
151 | * @param string $session Required. The name of the session the feedback was
|
---|
152 | * sent to.
|
---|
153 | * @param GoogleCloudDialogflowCxV3SubmitAnswerFeedbackRequest $postBody
|
---|
154 | * @param array $optParams Optional parameters.
|
---|
155 | * @return GoogleCloudDialogflowCxV3AnswerFeedback
|
---|
156 | * @throws \Google\Service\Exception
|
---|
157 | */
|
---|
158 | public function submitAnswerFeedback($session, GoogleCloudDialogflowCxV3SubmitAnswerFeedbackRequest $postBody, $optParams = [])
|
---|
159 | {
|
---|
160 | $params = ['session' => $session, 'postBody' => $postBody];
|
---|
161 | $params = array_merge($params, $optParams);
|
---|
162 | return $this->call('submitAnswerFeedback', [$params], GoogleCloudDialogflowCxV3AnswerFeedback::class);
|
---|
163 | }
|
---|
164 | }
|
---|
165 |
|
---|
166 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
167 | class_alias(ProjectsLocationsAgentsSessions::class, 'Google_Service_Dialogflow_Resource_ProjectsLocationsAgentsSessions');
|
---|