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\AdExchangeBuyerII\Resource;
19
20use Google\Service\AdExchangeBuyerII\AddDealAssociationRequest;
21use Google\Service\AdExchangeBuyerII\Adexchangebuyer2Empty;
22use Google\Service\AdExchangeBuyerII\ListDealAssociationsResponse;
23use Google\Service\AdExchangeBuyerII\RemoveDealAssociationRequest;
24
25/**
26 * The "dealAssociations" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $adexchangebuyer2Service = new Google\Service\AdExchangeBuyerII(...);
30 *   $dealAssociations = $adexchangebuyer2Service->dealAssociations;
31 *  </code>
32 */
33class AccountsCreativesDealAssociations extends \Google\Service\Resource
34{
35  /**
36   * Associate an existing deal with a creative. (dealAssociations.add)
37   *
38   * @param string $accountId The account the creative belongs to.
39   * @param string $creativeId The ID of the creative associated with the deal.
40   * @param AddDealAssociationRequest $postBody
41   * @param array $optParams Optional parameters.
42   * @return Adexchangebuyer2Empty
43   */
44  public function add($accountId, $creativeId, AddDealAssociationRequest $postBody, $optParams = [])
45  {
46    $params = ['accountId' => $accountId, 'creativeId' => $creativeId, 'postBody' => $postBody];
47    $params = array_merge($params, $optParams);
48    return $this->call('add', [$params], Adexchangebuyer2Empty::class);
49  }
50  /**
51   * List all creative-deal associations.
52   * (dealAssociations.listAccountsCreativesDealAssociations)
53   *
54   * @param string $accountId The account to list the associations from. Specify
55   * "-" to list all creatives the current user has access to.
56   * @param string $creativeId The creative ID to list the associations from.
57   * Specify "-" to list all creatives under the above account.
58   * @param array $optParams Optional parameters.
59   *
60   * @opt_param int pageSize Requested page size. Server may return fewer
61   * associations than requested. If unspecified, server will pick an appropriate
62   * default.
63   * @opt_param string pageToken A token identifying a page of results the server
64   * should return. Typically, this is the value of
65   * ListDealAssociationsResponse.next_page_token returned from the previous call
66   * to 'ListDealAssociations' method.
67   * @opt_param string query An optional query string to filter deal associations.
68   * If no filter is specified, all associations will be returned. Supported
69   * queries are: - accountId=*account_id_string* -
70   * creativeId=*creative_id_string* - dealsId=*deals_id_string* -
71   * dealsStatus:{approved, conditionally_approved, disapproved, not_checked} -
72   * openAuctionStatus:{approved, conditionally_approved, disapproved,
73   * not_checked} Example: 'dealsId=12345 AND dealsStatus:disapproved'
74   * @return ListDealAssociationsResponse
75   */
76  public function listAccountsCreativesDealAssociations($accountId, $creativeId, $optParams = [])
77  {
78    $params = ['accountId' => $accountId, 'creativeId' => $creativeId];
79    $params = array_merge($params, $optParams);
80    return $this->call('list', [$params], ListDealAssociationsResponse::class);
81  }
82  /**
83   * Remove the association between a deal and a creative.
84   * (dealAssociations.remove)
85   *
86   * @param string $accountId The account the creative belongs to.
87   * @param string $creativeId The ID of the creative associated with the deal.
88   * @param RemoveDealAssociationRequest $postBody
89   * @param array $optParams Optional parameters.
90   * @return Adexchangebuyer2Empty
91   */
92  public function remove($accountId, $creativeId, RemoveDealAssociationRequest $postBody, $optParams = [])
93  {
94    $params = ['accountId' => $accountId, 'creativeId' => $creativeId, 'postBody' => $postBody];
95    $params = array_merge($params, $optParams);
96    return $this->call('remove', [$params], Adexchangebuyer2Empty::class);
97  }
98}
99
100// Adding a class alias for backwards compatibility with the previous class name.
101class_alias(AccountsCreativesDealAssociations::class, 'Google_Service_AdExchangeBuyerII_Resource_AccountsCreativesDealAssociations');
102