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\BulkEditNegativeKeywordsRequest;
21use Google\Service\DisplayVideo\BulkEditNegativeKeywordsResponse;
22use Google\Service\DisplayVideo\DisplayvideoEmpty;
23use Google\Service\DisplayVideo\ListNegativeKeywordsResponse;
24use Google\Service\DisplayVideo\NegativeKeyword;
25use Google\Service\DisplayVideo\ReplaceNegativeKeywordsRequest;
26use Google\Service\DisplayVideo\ReplaceNegativeKeywordsResponse;
27
28/**
29 * The "negativeKeywords" collection of methods.
30 * Typical usage is:
31 *  <code>
32 *   $displayvideoService = new Google\Service\DisplayVideo(...);
33 *   $negativeKeywords = $displayvideoService->negativeKeywords;
34 *  </code>
35 */
36class AdvertisersNegativeKeywordListsNegativeKeywords extends \Google\Service\Resource
37{
38  /**
39   * Bulk edits negative keywords in a single negative keyword list. The operation
40   * will delete the negative keywords provided in
41   * BulkEditNegativeKeywordsRequest.deleted_negative_keywords and then create the
42   * negative keywords provided in
43   * BulkEditNegativeKeywordsRequest.created_negative_keywords. This operation is
44   * guaranteed to be atomic and will never result in a partial success or partial
45   * failure. (negativeKeywords.bulkEdit)
46   *
47   * @param string $advertiserId Required. The ID of the DV360 advertiser to which
48   * the parent negative keyword list belongs.
49   * @param string $negativeKeywordListId Required. The ID of the parent negative
50   * keyword list to which the negative keywords belong.
51   * @param BulkEditNegativeKeywordsRequest $postBody
52   * @param array $optParams Optional parameters.
53   * @return BulkEditNegativeKeywordsResponse
54   */
55  public function bulkEdit($advertiserId, $negativeKeywordListId, BulkEditNegativeKeywordsRequest $postBody, $optParams = [])
56  {
57    $params = ['advertiserId' => $advertiserId, 'negativeKeywordListId' => $negativeKeywordListId, 'postBody' => $postBody];
58    $params = array_merge($params, $optParams);
59    return $this->call('bulkEdit', [$params], BulkEditNegativeKeywordsResponse::class);
60  }
61  /**
62   * Creates a negative keyword in a negative keyword list.
63   * (negativeKeywords.create)
64   *
65   * @param string $advertiserId Required. The ID of the DV360 advertiser to which
66   * the parent negative keyword list belongs.
67   * @param string $negativeKeywordListId Required. The ID of the parent negative
68   * keyword list in which the negative keyword will be created.
69   * @param NegativeKeyword $postBody
70   * @param array $optParams Optional parameters.
71   * @return NegativeKeyword
72   */
73  public function create($advertiserId, $negativeKeywordListId, NegativeKeyword $postBody, $optParams = [])
74  {
75    $params = ['advertiserId' => $advertiserId, 'negativeKeywordListId' => $negativeKeywordListId, 'postBody' => $postBody];
76    $params = array_merge($params, $optParams);
77    return $this->call('create', [$params], NegativeKeyword::class);
78  }
79  /**
80   * Deletes a negative keyword from a negative keyword list.
81   * (negativeKeywords.delete)
82   *
83   * @param string $advertiserId Required. The ID of the DV360 advertiser to which
84   * the parent negative keyword list belongs.
85   * @param string $negativeKeywordListId Required. The ID of the parent negative
86   * keyword list to which the negative keyword belongs.
87   * @param string $keywordValue Required. The keyword value of the negative
88   * keyword to delete.
89   * @param array $optParams Optional parameters.
90   * @return DisplayvideoEmpty
91   */
92  public function delete($advertiserId, $negativeKeywordListId, $keywordValue, $optParams = [])
93  {
94    $params = ['advertiserId' => $advertiserId, 'negativeKeywordListId' => $negativeKeywordListId, 'keywordValue' => $keywordValue];
95    $params = array_merge($params, $optParams);
96    return $this->call('delete', [$params], DisplayvideoEmpty::class);
97  }
98  /**
99   * Lists negative keywords in a negative keyword list.
100   * (negativeKeywords.listAdvertisersNegativeKeywordListsNegativeKeywords)
101   *
102   * @param string $advertiserId Required. The ID of the DV360 advertiser to which
103   * the parent negative keyword list belongs.
104   * @param string $negativeKeywordListId Required. The ID of the parent negative
105   * keyword list to which the requested negative keywords belong.
106   * @param array $optParams Optional parameters.
107   *
108   * @opt_param string filter Allows filtering by negative keyword fields.
109   * Supported syntax: * Filter expressions for negative keyword currently can
110   * only contain at most one * restriction. * A restriction has the form of
111   * `{field} {operator} {value}`. * The operator must be `CONTAINS (:)`. *
112   * Supported fields: - `keywordValue` Examples: * All negative keywords for
113   * which the keyword value contains "google": `keywordValue : "google"`
114   * @opt_param string orderBy Field by which to sort the list. Acceptable values
115   * are: * `keywordValue` (default) The default sorting order is ascending. To
116   * specify descending order for a field, a suffix " desc" should be added to the
117   * field name. Example: `keywordValue desc`.
118   * @opt_param int pageSize Requested page size. Must be between `1` and `1000`.
119   * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT`
120   * if an invalid value is specified.
121   * @opt_param string pageToken A token identifying a page of results the server
122   * should return. Typically, this is the value of next_page_token returned from
123   * the previous call to `ListNegativeKeywords` method. If not specified, the
124   * first page of results will be returned.
125   * @return ListNegativeKeywordsResponse
126   */
127  public function listAdvertisersNegativeKeywordListsNegativeKeywords($advertiserId, $negativeKeywordListId, $optParams = [])
128  {
129    $params = ['advertiserId' => $advertiserId, 'negativeKeywordListId' => $negativeKeywordListId];
130    $params = array_merge($params, $optParams);
131    return $this->call('list', [$params], ListNegativeKeywordsResponse::class);
132  }
133  /**
134   * Replaces all negative keywords in a single negative keyword list. The
135   * operation will replace the keywords in a negative keyword list with keywords
136   * provided in ReplaceNegativeKeywordsRequest.new_negative_keywords.
137   * (negativeKeywords.replace)
138   *
139   * @param string $advertiserId Required. The ID of the DV360 advertiser to which
140   * the parent negative keyword list belongs.
141   * @param string $negativeKeywordListId Required. The ID of the parent negative
142   * keyword list to which the negative keywords belong.
143   * @param ReplaceNegativeKeywordsRequest $postBody
144   * @param array $optParams Optional parameters.
145   * @return ReplaceNegativeKeywordsResponse
146   */
147  public function replace($advertiserId, $negativeKeywordListId, ReplaceNegativeKeywordsRequest $postBody, $optParams = [])
148  {
149    $params = ['advertiserId' => $advertiserId, 'negativeKeywordListId' => $negativeKeywordListId, 'postBody' => $postBody];
150    $params = array_merge($params, $optParams);
151    return $this->call('replace', [$params], ReplaceNegativeKeywordsResponse::class);
152  }
153}
154
155// Adding a class alias for backwards compatibility with the previous class name.
156class_alias(AdvertisersNegativeKeywordListsNegativeKeywords::class, 'Google_Service_DisplayVideo_Resource_AdvertisersNegativeKeywordListsNegativeKeywords');
157