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\GoogleCloudDialogflowCxV3CompareVersionsRequest;
21use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3CompareVersionsResponse;
22use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3ListVersionsResponse;
23use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3LoadVersionRequest;
24use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3Version;
25use Google\Service\Dialogflow\GoogleLongrunningOperation;
26use Google\Service\Dialogflow\GoogleProtobufEmpty;
27
28/**
29 * The "versions" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $dialogflowService = new Google\Service\Dialogflow(...);
33 *   $versions = $dialogflowService->versions;
34 *  </code>
35 */
36class ProjectsLocationsAgentsFlowsVersions extends \Google\Service\Resource
37{
38  /**
39   * Compares the specified base version with target version.
40   * (versions.compareVersions)
41   *
42   * @param string $baseVersion Required. Name of the base flow version to compare
43   * with the target version. Use version ID `0` to indicate the draft version of
44   * the specified flow. Format: `projects//locations//agents/ /flows//versions/`.
45   * @param GoogleCloudDialogflowCxV3CompareVersionsRequest $postBody
46   * @param array $optParams Optional parameters.
47   * @return GoogleCloudDialogflowCxV3CompareVersionsResponse
48   */
49  public function compareVersions($baseVersion, GoogleCloudDialogflowCxV3CompareVersionsRequest $postBody, $optParams = [])
50  {
51    $params = ['baseVersion' => $baseVersion, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('compareVersions', [$params], GoogleCloudDialogflowCxV3CompareVersionsResponse::class);
54  }
55  /**
56   * Creates a Version in the specified Flow. This method is a [long-running
57   * operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-
58   * operation). The returned `Operation` type has the following method-specific
59   * fields: - `metadata`: CreateVersionOperationMetadata - `response`: Version
60   * (versions.create)
61   *
62   * @param string $parent Required. The Flow to create an Version for. Format:
63   * `projects//locations//agents//flows/`.
64   * @param GoogleCloudDialogflowCxV3Version $postBody
65   * @param array $optParams Optional parameters.
66   * @return GoogleLongrunningOperation
67   */
68  public function create($parent, GoogleCloudDialogflowCxV3Version $postBody, $optParams = [])
69  {
70    $params = ['parent' => $parent, 'postBody' => $postBody];
71    $params = array_merge($params, $optParams);
72    return $this->call('create', [$params], GoogleLongrunningOperation::class);
73  }
74  /**
75   * Deletes the specified Version. (versions.delete)
76   *
77   * @param string $name Required. The name of the Version to delete. Format:
78   * `projects//locations//agents//flows//versions/`.
79   * @param array $optParams Optional parameters.
80   * @return GoogleProtobufEmpty
81   */
82  public function delete($name, $optParams = [])
83  {
84    $params = ['name' => $name];
85    $params = array_merge($params, $optParams);
86    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
87  }
88  /**
89   * Retrieves the specified Version. (versions.get)
90   *
91   * @param string $name Required. The name of the Version. Format:
92   * `projects//locations//agents//flows//versions/`.
93   * @param array $optParams Optional parameters.
94   * @return GoogleCloudDialogflowCxV3Version
95   */
96  public function get($name, $optParams = [])
97  {
98    $params = ['name' => $name];
99    $params = array_merge($params, $optParams);
100    return $this->call('get', [$params], GoogleCloudDialogflowCxV3Version::class);
101  }
102  /**
103   * Returns the list of all versions in the specified Flow.
104   * (versions.listProjectsLocationsAgentsFlowsVersions)
105   *
106   * @param string $parent Required. The Flow to list all versions for. Format:
107   * `projects//locations//agents//flows/`.
108   * @param array $optParams Optional parameters.
109   *
110   * @opt_param int pageSize The maximum number of items to return in a single
111   * page. By default 20 and at most 100.
112   * @opt_param string pageToken The next_page_token value returned from a
113   * previous list request.
114   * @return GoogleCloudDialogflowCxV3ListVersionsResponse
115   */
116  public function listProjectsLocationsAgentsFlowsVersions($parent, $optParams = [])
117  {
118    $params = ['parent' => $parent];
119    $params = array_merge($params, $optParams);
120    return $this->call('list', [$params], GoogleCloudDialogflowCxV3ListVersionsResponse::class);
121  }
122  /**
123   * Loads resources in the specified version to the draft flow. This method is a
124   * [long-running operation](https://cloud.google.com/dialogflow/cx/docs/how
125   * /long-running-operation). The returned `Operation` type has the following
126   * method-specific fields: - `metadata`: An empty [Struct
127   * message](https://developers.google.com/protocol-
128   * buffers/docs/reference/google.protobuf#struct) - `response`: An [Empty
129   * message](https://developers.google.com/protocol-
130   * buffers/docs/reference/google.protobuf#empty) (versions.load)
131   *
132   * @param string $name Required. The Version to be loaded to draft flow. Format:
133   * `projects//locations//agents//flows//versions/`.
134   * @param GoogleCloudDialogflowCxV3LoadVersionRequest $postBody
135   * @param array $optParams Optional parameters.
136   * @return GoogleLongrunningOperation
137   */
138  public function load($name, GoogleCloudDialogflowCxV3LoadVersionRequest $postBody, $optParams = [])
139  {
140    $params = ['name' => $name, 'postBody' => $postBody];
141    $params = array_merge($params, $optParams);
142    return $this->call('load', [$params], GoogleLongrunningOperation::class);
143  }
144  /**
145   * Updates the specified Version. (versions.patch)
146   *
147   * @param string $name Format: projects//locations//agents//flows//versions/.
148   * Version ID is a self-increasing number generated by Dialogflow upon version
149   * creation.
150   * @param GoogleCloudDialogflowCxV3Version $postBody
151   * @param array $optParams Optional parameters.
152   *
153   * @opt_param string updateMask Required. The mask to control which fields get
154   * updated. Currently only `description` and `display_name` can be updated.
155   * @return GoogleCloudDialogflowCxV3Version
156   */
157  public function patch($name, GoogleCloudDialogflowCxV3Version $postBody, $optParams = [])
158  {
159    $params = ['name' => $name, 'postBody' => $postBody];
160    $params = array_merge($params, $optParams);
161    return $this->call('patch', [$params], GoogleCloudDialogflowCxV3Version::class);
162  }
163}
164
165// Adding a class alias for backwards compatibility with the previous class name.
166class_alias(ProjectsLocationsAgentsFlowsVersions::class, 'Google_Service_Dialogflow_Resource_ProjectsLocationsAgentsFlowsVersions');
167