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\DisplayVideo\Resource;
19
20use Google\Service\DisplayVideo\ActivateManualTriggerRequest;
21use Google\Service\DisplayVideo\DeactivateManualTriggerRequest;
22use Google\Service\DisplayVideo\ListManualTriggersResponse;
23use Google\Service\DisplayVideo\ManualTrigger;
24
25/**
26 * The "manualTriggers" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $displayvideoService = new Google\Service\DisplayVideo(...);
30 *   $manualTriggers = $displayvideoService->manualTriggers;
31 *  </code>
32 */
33class AdvertisersManualTriggers extends \Google\Service\Resource
34{
35  /**
36   * Activates a manual trigger. Each activation of the manual trigger must be at
37   * least 5 minutes apart, otherwise an error will be returned.
38   * (manualTriggers.activate)
39   *
40   * @param string $advertiserId Required. The ID of the advertiser that the
41   * manual trigger belongs.
42   * @param string $triggerId Required. The ID of the manual trigger to activate.
43   * @param ActivateManualTriggerRequest $postBody
44   * @param array $optParams Optional parameters.
45   * @return ManualTrigger
46   */
47  public function activate($advertiserId, $triggerId, ActivateManualTriggerRequest $postBody, $optParams = [])
48  {
49    $params = ['advertiserId' => $advertiserId, 'triggerId' => $triggerId, 'postBody' => $postBody];
50    $params = array_merge($params, $optParams);
51    return $this->call('activate', [$params], ManualTrigger::class);
52  }
53  /**
54   * Creates a new manual trigger. Returns the newly created manual trigger if
55   * successful. (manualTriggers.create)
56   *
57   * @param string $advertiserId Required. Immutable. The unique ID of the
58   * advertiser that the manual trigger belongs to.
59   * @param ManualTrigger $postBody
60   * @param array $optParams Optional parameters.
61   * @return ManualTrigger
62   */
63  public function create($advertiserId, ManualTrigger $postBody, $optParams = [])
64  {
65    $params = ['advertiserId' => $advertiserId, 'postBody' => $postBody];
66    $params = array_merge($params, $optParams);
67    return $this->call('create', [$params], ManualTrigger::class);
68  }
69  /**
70   * Deactivates a manual trigger. (manualTriggers.deactivate)
71   *
72   * @param string $advertiserId Required. The ID of the advertiser that the
73   * manual trigger belongs.
74   * @param string $triggerId Required. The ID of the manual trigger to
75   * deactivate.
76   * @param DeactivateManualTriggerRequest $postBody
77   * @param array $optParams Optional parameters.
78   * @return ManualTrigger
79   */
80  public function deactivate($advertiserId, $triggerId, DeactivateManualTriggerRequest $postBody, $optParams = [])
81  {
82    $params = ['advertiserId' => $advertiserId, 'triggerId' => $triggerId, 'postBody' => $postBody];
83    $params = array_merge($params, $optParams);
84    return $this->call('deactivate', [$params], ManualTrigger::class);
85  }
86  /**
87   * Gets a manual trigger. (manualTriggers.get)
88   *
89   * @param string $advertiserId Required. The ID of the advertiser this manual
90   * trigger belongs to.
91   * @param string $triggerId Required. The ID of the manual trigger to fetch.
92   * @param array $optParams Optional parameters.
93   * @return ManualTrigger
94   */
95  public function get($advertiserId, $triggerId, $optParams = [])
96  {
97    $params = ['advertiserId' => $advertiserId, 'triggerId' => $triggerId];
98    $params = array_merge($params, $optParams);
99    return $this->call('get', [$params], ManualTrigger::class);
100  }
101  /**
102   * Lists manual triggers that are accessible to the current user for a given
103   * advertiser ID. The order is defined by the order_by parameter. A single
104   * advertiser_id is required. (manualTriggers.listAdvertisersManualTriggers)
105   *
106   * @param string $advertiserId Required. The ID of the advertiser that the
107   * fetched manual triggers belong to.
108   * @param array $optParams Optional parameters.
109   *
110   * @opt_param string filter Allows filtering by manual trigger properties.
111   * Supported syntax: * Filter expressions are made up of one or more
112   * restrictions. * Restrictions can be combined by `AND` or `OR` logical
113   * operators. A sequence of restrictions implicitly uses `AND`. * A restriction
114   * has the form of `{field} {operator} {value}`. * The operator must be `EQUALS
115   * (=)`. * Supported fields: - `displayName` - `state` Examples: * All active
116   * manual triggers under an advertiser: `state="ACTIVE"` The length of this
117   * field should be no more than 500 characters.
118   * @opt_param string orderBy Field by which to sort the list. Acceptable values
119   * are: * `displayName` (default) * `state` The default sorting order is
120   * ascending. To specify descending order for a field, a suffix "desc" should be
121   * added to the field name. For example, `displayName desc`.
122   * @opt_param int pageSize Requested page size. Must be between `1` and `100`.
123   * If unspecified will default to `100`.
124   * @opt_param string pageToken A token identifying a page of results the server
125   * should return. Typically, this is the value of next_page_token returned from
126   * the previous call to `ListManualTriggers` method. If not specified, the first
127   * page of results will be returned.
128   * @return ListManualTriggersResponse
129   */
130  public function listAdvertisersManualTriggers($advertiserId, $optParams = [])
131  {
132    $params = ['advertiserId' => $advertiserId];
133    $params = array_merge($params, $optParams);
134    return $this->call('list', [$params], ListManualTriggersResponse::class);
135  }
136  /**
137   * Updates a manual trigger. Returns the updated manual trigger if successful.
138   * (manualTriggers.patch)
139   *
140   * @param string $advertiserId Required. Immutable. The unique ID of the
141   * advertiser that the manual trigger belongs to.
142   * @param string $triggerId Output only. The unique ID of the manual trigger.
143   * @param ManualTrigger $postBody
144   * @param array $optParams Optional parameters.
145   *
146   * @opt_param string updateMask Required. The mask to control which fields to
147   * update.
148   * @return ManualTrigger
149   */
150  public function patch($advertiserId, $triggerId, ManualTrigger $postBody, $optParams = [])
151  {
152    $params = ['advertiserId' => $advertiserId, 'triggerId' => $triggerId, 'postBody' => $postBody];
153    $params = array_merge($params, $optParams);
154    return $this->call('patch', [$params], ManualTrigger::class);
155  }
156}
157
158// Adding a class alias for backwards compatibility with the previous class name.
159class_alias(AdvertisersManualTriggers::class, 'Google_Service_DisplayVideo_Resource_AdvertisersManualTriggers');
160