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\GoogleCloudDialogflowCxV3DetectIntentRequest;
21use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3DetectIntentResponse;
22use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3FulfillIntentRequest;
23use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3FulfillIntentResponse;
24use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3MatchIntentRequest;
25use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3MatchIntentResponse;
26
27/**
28 * The "sessions" collection of methods.
29 * Typical usage is:
30 *  <code>
31 *   $dialogflowService = new Google\Service\Dialogflow(...);
32 *   $sessions = $dialogflowService->sessions;
33 *  </code>
34 */
35class ProjectsLocationsAgentsSessions extends \Google\Service\Resource
36{
37  /**
38   * Processes a natural language query and returns structured, actionable data as
39   * a result. This method is not idempotent, because it may cause session entity
40   * types to be updated, which in turn might affect results of future queries.
41   * Note: Always use agent versions for production traffic. See [Versions and
42   * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
43   * (sessions.detectIntent)
44   *
45   * @param string $session Required. The name of the session this query is sent
46   * to. Format: `projects//locations//agents//sessions/` or
47   * `projects//locations//agents//environments//sessions/`. If `Environment ID`
48   * is not specified, we assume default 'draft' environment. It's up to the API
49   * caller to choose an appropriate `Session ID`. It can be a random number or
50   * some type of session identifiers (preferably hashed). The length of the
51   * `Session ID` must not exceed 36 characters. For more information, see the
52   * [sessions
53   * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session). Note:
54   * Always use agent versions for production traffic. See [Versions and
55   * environments](https://cloud.google.com/dialogflow/cx/docs/concept/version).
56   * @param GoogleCloudDialogflowCxV3DetectIntentRequest $postBody
57   * @param array $optParams Optional parameters.
58   * @return GoogleCloudDialogflowCxV3DetectIntentResponse
59   */
60  public function detectIntent($session, GoogleCloudDialogflowCxV3DetectIntentRequest $postBody, $optParams = [])
61  {
62    $params = ['session' => $session, 'postBody' => $postBody];
63    $params = array_merge($params, $optParams);
64    return $this->call('detectIntent', [$params], GoogleCloudDialogflowCxV3DetectIntentResponse::class);
65  }
66  /**
67   * Fulfills a matched intent returned by MatchIntent. Must be called after
68   * MatchIntent, with input from MatchIntentResponse. Otherwise, the behavior is
69   * undefined. (sessions.fulfillIntent)
70   *
71   * @param string $session Required. The name of the session this query is sent
72   * to. Format: `projects//locations//agents//sessions/` or
73   * `projects//locations//agents//environments//sessions/`. If `Environment ID`
74   * is not specified, we assume default 'draft' environment. It's up to the API
75   * caller to choose an appropriate `Session ID`. It can be a random number or
76   * some type of session identifiers (preferably hashed). The length of the
77   * `Session ID` must not exceed 36 characters. For more information, see the
78   * [sessions
79   * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
80   * @param GoogleCloudDialogflowCxV3FulfillIntentRequest $postBody
81   * @param array $optParams Optional parameters.
82   * @return GoogleCloudDialogflowCxV3FulfillIntentResponse
83   */
84  public function fulfillIntent($session, GoogleCloudDialogflowCxV3FulfillIntentRequest $postBody, $optParams = [])
85  {
86    $params = ['session' => $session, 'postBody' => $postBody];
87    $params = array_merge($params, $optParams);
88    return $this->call('fulfillIntent', [$params], GoogleCloudDialogflowCxV3FulfillIntentResponse::class);
89  }
90  /**
91   * Returns preliminary intent match results, doesn't change the session status.
92   * (sessions.matchIntent)
93   *
94   * @param string $session Required. The name of the session this query is sent
95   * to. Format: `projects//locations//agents//sessions/` or
96   * `projects//locations//agents//environments//sessions/`. If `Environment ID`
97   * is not specified, we assume default 'draft' environment. It's up to the API
98   * caller to choose an appropriate `Session ID`. It can be a random number or
99   * some type of session identifiers (preferably hashed). The length of the
100   * `Session ID` must not exceed 36 characters. For more information, see the
101   * [sessions
102   * guide](https://cloud.google.com/dialogflow/cx/docs/concept/session).
103   * @param GoogleCloudDialogflowCxV3MatchIntentRequest $postBody
104   * @param array $optParams Optional parameters.
105   * @return GoogleCloudDialogflowCxV3MatchIntentResponse
106   */
107  public function matchIntent($session, GoogleCloudDialogflowCxV3MatchIntentRequest $postBody, $optParams = [])
108  {
109    $params = ['session' => $session, 'postBody' => $postBody];
110    $params = array_merge($params, $optParams);
111    return $this->call('matchIntent', [$params], GoogleCloudDialogflowCxV3MatchIntentResponse::class);
112  }
113}
114
115// Adding a class alias for backwards compatibility with the previous class name.
116class_alias(ProjectsLocationsAgentsSessions::class, 'Google_Service_Dialogflow_Resource_ProjectsLocationsAgentsSessions');
117