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\GoogleCloudDialogflowCxV3ListWebhooksResponse;
21use Google\Service\Dialogflow\GoogleCloudDialogflowCxV3Webhook;
22use Google\Service\Dialogflow\GoogleProtobufEmpty;
23
24/**
25 * The "webhooks" collection of methods.
26 * Typical usage is:
27 *  <code>
28 *   $dialogflowService = new Google\Service\Dialogflow(...);
29 *   $webhooks = $dialogflowService->webhooks;
30 *  </code>
31 */
32class ProjectsLocationsAgentsWebhooks extends \Google\Service\Resource
33{
34  /**
35   * Creates a webhook in the specified agent. (webhooks.create)
36   *
37   * @param string $parent Required. The agent to create a webhook for. Format:
38   * `projects//locations//agents/`.
39   * @param GoogleCloudDialogflowCxV3Webhook $postBody
40   * @param array $optParams Optional parameters.
41   * @return GoogleCloudDialogflowCxV3Webhook
42   */
43  public function create($parent, GoogleCloudDialogflowCxV3Webhook $postBody, $optParams = [])
44  {
45    $params = ['parent' => $parent, 'postBody' => $postBody];
46    $params = array_merge($params, $optParams);
47    return $this->call('create', [$params], GoogleCloudDialogflowCxV3Webhook::class);
48  }
49  /**
50   * Deletes the specified webhook. (webhooks.delete)
51   *
52   * @param string $name Required. The name of the webhook to delete. Format:
53   * `projects//locations//agents//webhooks/`.
54   * @param array $optParams Optional parameters.
55   *
56   * @opt_param bool force This field has no effect for webhook not being used.
57   * For webhooks that are used by pages/flows/transition route groups: * If
58   * `force` is set to false, an error will be returned with message indicating
59   * the referenced resources. * If `force` is set to true, Dialogflow will remove
60   * the webhook, as well as any references to the webhook (i.e. Webhook and tagin
61   * fulfillments that point to this webhook will be removed).
62   * @return GoogleProtobufEmpty
63   */
64  public function delete($name, $optParams = [])
65  {
66    $params = ['name' => $name];
67    $params = array_merge($params, $optParams);
68    return $this->call('delete', [$params], GoogleProtobufEmpty::class);
69  }
70  /**
71   * Retrieves the specified webhook. (webhooks.get)
72   *
73   * @param string $name Required. The name of the webhook. Format:
74   * `projects//locations//agents//webhooks/`.
75   * @param array $optParams Optional parameters.
76   * @return GoogleCloudDialogflowCxV3Webhook
77   */
78  public function get($name, $optParams = [])
79  {
80    $params = ['name' => $name];
81    $params = array_merge($params, $optParams);
82    return $this->call('get', [$params], GoogleCloudDialogflowCxV3Webhook::class);
83  }
84  /**
85   * Returns the list of all webhooks in the specified agent.
86   * (webhooks.listProjectsLocationsAgentsWebhooks)
87   *
88   * @param string $parent Required. The agent to list all webhooks for. Format:
89   * `projects//locations//agents/`.
90   * @param array $optParams Optional parameters.
91   *
92   * @opt_param int pageSize The maximum number of items to return in a single
93   * page. By default 100 and at most 1000.
94   * @opt_param string pageToken The next_page_token value returned from a
95   * previous list request.
96   * @return GoogleCloudDialogflowCxV3ListWebhooksResponse
97   */
98  public function listProjectsLocationsAgentsWebhooks($parent, $optParams = [])
99  {
100    $params = ['parent' => $parent];
101    $params = array_merge($params, $optParams);
102    return $this->call('list', [$params], GoogleCloudDialogflowCxV3ListWebhooksResponse::class);
103  }
104  /**
105   * Updates the specified webhook. (webhooks.patch)
106   *
107   * @param string $name The unique identifier of the webhook. Required for the
108   * Webhooks.UpdateWebhook method. Webhooks.CreateWebhook populates the name
109   * automatically. Format: `projects//locations//agents//webhooks/`.
110   * @param GoogleCloudDialogflowCxV3Webhook $postBody
111   * @param array $optParams Optional parameters.
112   *
113   * @opt_param string updateMask The mask to control which fields get updated. If
114   * the mask is not present, all fields will be updated.
115   * @return GoogleCloudDialogflowCxV3Webhook
116   */
117  public function patch($name, GoogleCloudDialogflowCxV3Webhook $postBody, $optParams = [])
118  {
119    $params = ['name' => $name, 'postBody' => $postBody];
120    $params = array_merge($params, $optParams);
121    return $this->call('patch', [$params], GoogleCloudDialogflowCxV3Webhook::class);
122  }
123}
124
125// Adding a class alias for backwards compatibility with the previous class name.
126class_alias(ProjectsLocationsAgentsWebhooks::class, 'Google_Service_Dialogflow_Resource_ProjectsLocationsAgentsWebhooks');
127