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\AcceptProposalRequest; 21use Google\Service\AdExchangeBuyerII\AddNoteRequest; 22use Google\Service\AdExchangeBuyerII\CancelNegotiationRequest; 23use Google\Service\AdExchangeBuyerII\CompleteSetupRequest; 24use Google\Service\AdExchangeBuyerII\ListProposalsResponse; 25use Google\Service\AdExchangeBuyerII\Note; 26use Google\Service\AdExchangeBuyerII\PauseProposalRequest; 27use Google\Service\AdExchangeBuyerII\Proposal; 28use Google\Service\AdExchangeBuyerII\ResumeProposalRequest; 29 30/** 31 * The "proposals" collection of methods. 32 * Typical usage is: 33 * <code> 34 * $adexchangebuyer2Service = new Google\Service\AdExchangeBuyerII(...); 35 * $proposals = $adexchangebuyer2Service->proposals; 36 * </code> 37 */ 38class AccountsProposals extends \Google\Service\Resource 39{ 40 /** 41 * Mark the proposal as accepted at the given revision number. If the number 42 * does not match the server's revision number an `ABORTED` error message will 43 * be returned. This call updates the proposal_state from `PROPOSED` to 44 * `BUYER_ACCEPTED`, or from `SELLER_ACCEPTED` to `FINALIZED`. Upon calling this 45 * endpoint, the buyer implicitly agrees to the terms and conditions optionally 46 * set within the proposal by the publisher. (proposals.accept) 47 * 48 * @param string $accountId Account ID of the buyer. 49 * @param string $proposalId The ID of the proposal to accept. 50 * @param AcceptProposalRequest $postBody 51 * @param array $optParams Optional parameters. 52 * @return Proposal 53 */ 54 public function accept($accountId, $proposalId, AcceptProposalRequest $postBody, $optParams = []) 55 { 56 $params = ['accountId' => $accountId, 'proposalId' => $proposalId, 'postBody' => $postBody]; 57 $params = array_merge($params, $optParams); 58 return $this->call('accept', [$params], Proposal::class); 59 } 60 /** 61 * Create a new note and attach it to the proposal. The note is assigned a 62 * unique ID by the server. The proposal revision number will not increase when 63 * associated with a new note. (proposals.addNote) 64 * 65 * @param string $accountId Account ID of the buyer. 66 * @param string $proposalId The ID of the proposal to attach the note to. 67 * @param AddNoteRequest $postBody 68 * @param array $optParams Optional parameters. 69 * @return Note 70 */ 71 public function addNote($accountId, $proposalId, AddNoteRequest $postBody, $optParams = []) 72 { 73 $params = ['accountId' => $accountId, 'proposalId' => $proposalId, 'postBody' => $postBody]; 74 $params = array_merge($params, $optParams); 75 return $this->call('addNote', [$params], Note::class); 76 } 77 /** 78 * Cancel an ongoing negotiation on a proposal. This does not cancel or end 79 * serving for the deals if the proposal has been finalized, but only cancels a 80 * negotiation unilaterally. (proposals.cancelNegotiation) 81 * 82 * @param string $accountId Account ID of the buyer. 83 * @param string $proposalId The ID of the proposal to cancel negotiation for. 84 * @param CancelNegotiationRequest $postBody 85 * @param array $optParams Optional parameters. 86 * @return Proposal 87 */ 88 public function cancelNegotiation($accountId, $proposalId, CancelNegotiationRequest $postBody, $optParams = []) 89 { 90 $params = ['accountId' => $accountId, 'proposalId' => $proposalId, 'postBody' => $postBody]; 91 $params = array_merge($params, $optParams); 92 return $this->call('cancelNegotiation', [$params], Proposal::class); 93 } 94 /** 95 * Update the given proposal to indicate that setup has been completed. This 96 * method is called by the buyer when the line items have been created on their 97 * end for a finalized proposal and all the required creatives have been 98 * uploaded using the creatives API. This call updates the `is_setup_completed` 99 * bit on the proposal and also notifies the seller. The server will advance the 100 * revision number of the most recent proposal. (proposals.completeSetup) 101 * 102 * @param string $accountId Account ID of the buyer. 103 * @param string $proposalId The ID of the proposal to mark as setup completed. 104 * @param CompleteSetupRequest $postBody 105 * @param array $optParams Optional parameters. 106 * @return Proposal 107 */ 108 public function completeSetup($accountId, $proposalId, CompleteSetupRequest $postBody, $optParams = []) 109 { 110 $params = ['accountId' => $accountId, 'proposalId' => $proposalId, 'postBody' => $postBody]; 111 $params = array_merge($params, $optParams); 112 return $this->call('completeSetup', [$params], Proposal::class); 113 } 114 /** 115 * Create the given proposal. Each created proposal and any deals it contains 116 * are assigned a unique ID by the server. (proposals.create) 117 * 118 * @param string $accountId Account ID of the buyer. 119 * @param Proposal $postBody 120 * @param array $optParams Optional parameters. 121 * @return Proposal 122 */ 123 public function create($accountId, Proposal $postBody, $optParams = []) 124 { 125 $params = ['accountId' => $accountId, 'postBody' => $postBody]; 126 $params = array_merge($params, $optParams); 127 return $this->call('create', [$params], Proposal::class); 128 } 129 /** 130 * Gets a proposal given its ID. The proposal is returned at its head revision. 131 * (proposals.get) 132 * 133 * @param string $accountId Account ID of the buyer. 134 * @param string $proposalId The unique ID of the proposal 135 * @param array $optParams Optional parameters. 136 * @return Proposal 137 */ 138 public function get($accountId, $proposalId, $optParams = []) 139 { 140 $params = ['accountId' => $accountId, 'proposalId' => $proposalId]; 141 $params = array_merge($params, $optParams); 142 return $this->call('get', [$params], Proposal::class); 143 } 144 /** 145 * List proposals. A filter expression (PQL query) may be specified to filter 146 * the results. To retrieve all finalized proposals, regardless if a proposal is 147 * being renegotiated, see the FinalizedProposals resource. Note that 148 * Bidder/ChildSeat relationships differ from the usual behavior. A Bidder 149 * account can only see its child seats' proposals by specifying the ChildSeat's 150 * accountId in the request path. (proposals.listAccountsProposals) 151 * 152 * @param string $accountId Account ID of the buyer. 153 * @param array $optParams Optional parameters. 154 * 155 * @opt_param string filter An optional PQL filter query used to query for 156 * proposals. Nested repeated fields, such as proposal.deals.targetingCriterion, 157 * cannot be filtered. 158 * @opt_param string filterSyntax Syntax the filter is written in. Current 159 * implementation defaults to PQL but in the future it will be LIST_FILTER. 160 * @opt_param int pageSize Requested page size. The server may return fewer 161 * results than requested. If unspecified, the server will pick an appropriate 162 * default. 163 * @opt_param string pageToken The page token as returned from 164 * ListProposalsResponse. 165 * @return ListProposalsResponse 166 */ 167 public function listAccountsProposals($accountId, $optParams = []) 168 { 169 $params = ['accountId' => $accountId]; 170 $params = array_merge($params, $optParams); 171 return $this->call('list', [$params], ListProposalsResponse::class); 172 } 173 /** 174 * Update the given proposal to pause serving. This method will set the 175 * `DealServingMetadata.DealPauseStatus.has_buyer_paused` bit to true for all 176 * deals in the proposal. It is a no-op to pause an already-paused proposal. It 177 * is an error to call PauseProposal for a proposal that is not finalized or 178 * renegotiating. (proposals.pause) 179 * 180 * @param string $accountId Account ID of the buyer. 181 * @param string $proposalId The ID of the proposal to pause. 182 * @param PauseProposalRequest $postBody 183 * @param array $optParams Optional parameters. 184 * @return Proposal 185 */ 186 public function pause($accountId, $proposalId, PauseProposalRequest $postBody, $optParams = []) 187 { 188 $params = ['accountId' => $accountId, 'proposalId' => $proposalId, 'postBody' => $postBody]; 189 $params = array_merge($params, $optParams); 190 return $this->call('pause', [$params], Proposal::class); 191 } 192 /** 193 * Update the given proposal to resume serving. This method will set the 194 * `DealServingMetadata.DealPauseStatus.has_buyer_paused` bit to false for all 195 * deals in the proposal. Note that if the `has_seller_paused` bit is also set, 196 * serving will not resume until the seller also resumes. It is a no-op to 197 * resume an already-running proposal. It is an error to call ResumeProposal for 198 * a proposal that is not finalized or renegotiating. (proposals.resume) 199 * 200 * @param string $accountId Account ID of the buyer. 201 * @param string $proposalId The ID of the proposal to resume. 202 * @param ResumeProposalRequest $postBody 203 * @param array $optParams Optional parameters. 204 * @return Proposal 205 */ 206 public function resume($accountId, $proposalId, ResumeProposalRequest $postBody, $optParams = []) 207 { 208 $params = ['accountId' => $accountId, 'proposalId' => $proposalId, 'postBody' => $postBody]; 209 $params = array_merge($params, $optParams); 210 return $this->call('resume', [$params], Proposal::class); 211 } 212 /** 213 * Update the given proposal at the client known revision number. If the server 214 * revision has advanced since the passed-in `proposal.proposal_revision`, an 215 * `ABORTED` error message will be returned. Only the buyer-modifiable fields of 216 * the proposal will be updated. Note that the deals in the proposal will be 217 * updated to match the passed-in copy. If a passed-in deal does not have a 218 * `deal_id`, the server will assign a new unique ID and create the deal. If 219 * passed-in deal has a `deal_id`, it will be updated to match the passed-in 220 * copy. Any existing deals not present in the passed-in proposal will be 221 * deleted. It is an error to pass in a deal with a `deal_id` not present at 222 * head. (proposals.update) 223 * 224 * @param string $accountId Account ID of the buyer. 225 * @param string $proposalId The unique ID of the proposal. 226 * @param Proposal $postBody 227 * @param array $optParams Optional parameters. 228 * @return Proposal 229 */ 230 public function update($accountId, $proposalId, Proposal $postBody, $optParams = []) 231 { 232 $params = ['accountId' => $accountId, 'proposalId' => $proposalId, 'postBody' => $postBody]; 233 $params = array_merge($params, $optParams); 234 return $this->call('update', [$params], Proposal::class); 235 } 236} 237 238// Adding a class alias for backwards compatibility with the previous class name. 239class_alias(AccountsProposals::class, 'Google_Service_AdExchangeBuyerII_Resource_AccountsProposals'); 240