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