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\ListProposalsResponse;
21use Google\Service\AdExchangeBuyerII\PauseProposalDealsRequest;
22use Google\Service\AdExchangeBuyerII\Proposal;
23use Google\Service\AdExchangeBuyerII\ResumeProposalDealsRequest;
24
25/**
26 * The "finalizedProposals" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $adexchangebuyer2Service = new Google\Service\AdExchangeBuyerII(...);
30 *   $finalizedProposals = $adexchangebuyer2Service->finalizedProposals;
31 *  </code>
32 */
33class AccountsFinalizedProposals extends \Google\Service\Resource
34{
35  /**
36   * List finalized proposals, regardless if a proposal is being renegotiated. A
37   * filter expression (PQL query) may be specified to filter the results. The
38   * notes will not be returned.
39   * (finalizedProposals.listAccountsFinalizedProposals)
40   *
41   * @param string $accountId Account ID of the buyer.
42   * @param array $optParams Optional parameters.
43   *
44   * @opt_param string filter An optional PQL filter query used to query for
45   * proposals. Nested repeated fields, such as proposal.deals.targetingCriterion,
46   * cannot be filtered.
47   * @opt_param string filterSyntax Syntax the filter is written in. Current
48   * implementation defaults to PQL but in the future it will be LIST_FILTER.
49   * @opt_param int pageSize Requested page size. The server may return fewer
50   * results than requested. If unspecified, the server will pick an appropriate
51   * default.
52   * @opt_param string pageToken The page token as returned from
53   * ListProposalsResponse.
54   * @return ListProposalsResponse
55   */
56  public function listAccountsFinalizedProposals($accountId, $optParams = [])
57  {
58    $params = ['accountId' => $accountId];
59    $params = array_merge($params, $optParams);
60    return $this->call('list', [$params], ListProposalsResponse::class);
61  }
62  /**
63   * Update given deals to pause serving. This method will set the
64   * `DealServingMetadata.DealPauseStatus.has_buyer_paused` bit to true for all
65   * listed deals in the request. Currently, this method only applies to PG and PD
66   * deals. For PA deals, please call accounts.proposals.pause endpoint. It is a
67   * no-op to pause already-paused deals. It is an error to call
68   * PauseProposalDeals for deals which are not part of the proposal of
69   * proposal_id or which are not finalized or renegotiating.
70   * (finalizedProposals.pause)
71   *
72   * @param string $accountId Account ID of the buyer.
73   * @param string $proposalId The proposal_id of the proposal containing the
74   * deals.
75   * @param PauseProposalDealsRequest $postBody
76   * @param array $optParams Optional parameters.
77   * @return Proposal
78   */
79  public function pause($accountId, $proposalId, PauseProposalDealsRequest $postBody, $optParams = [])
80  {
81    $params = ['accountId' => $accountId, 'proposalId' => $proposalId, 'postBody' => $postBody];
82    $params = array_merge($params, $optParams);
83    return $this->call('pause', [$params], Proposal::class);
84  }
85  /**
86   * Update given deals to resume serving. This method will set the
87   * `DealServingMetadata.DealPauseStatus.has_buyer_paused` bit to false for all
88   * listed deals in the request. Currently, this method only applies to PG and PD
89   * deals. For PA deals, please call accounts.proposals.resume endpoint. It is a
90   * no-op to resume running deals or deals paused by the other party. It is an
91   * error to call ResumeProposalDeals for deals which are not part of the
92   * proposal of proposal_id or which are not finalized or renegotiating.
93   * (finalizedProposals.resume)
94   *
95   * @param string $accountId Account ID of the buyer.
96   * @param string $proposalId The proposal_id of the proposal containing the
97   * deals.
98   * @param ResumeProposalDealsRequest $postBody
99   * @param array $optParams Optional parameters.
100   * @return Proposal
101   */
102  public function resume($accountId, $proposalId, ResumeProposalDealsRequest $postBody, $optParams = [])
103  {
104    $params = ['accountId' => $accountId, 'proposalId' => $proposalId, 'postBody' => $postBody];
105    $params = array_merge($params, $optParams);
106    return $this->call('resume', [$params], Proposal::class);
107  }
108}
109
110// Adding a class alias for backwards compatibility with the previous class name.
111class_alias(AccountsFinalizedProposals::class, 'Google_Service_AdExchangeBuyerII_Resource_AccountsFinalizedProposals');
112