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\AuthorizedBuyersMarketplace\Resource; 19 20use Google\Service\AuthorizedBuyersMarketplace\AcceptProposalRequest; 21use Google\Service\AuthorizedBuyersMarketplace\AddNoteRequest; 22use Google\Service\AuthorizedBuyersMarketplace\CancelNegotiationRequest; 23use Google\Service\AuthorizedBuyersMarketplace\ListProposalsResponse; 24use Google\Service\AuthorizedBuyersMarketplace\Proposal; 25use Google\Service\AuthorizedBuyersMarketplace\SendRfpRequest; 26 27/** 28 * The "proposals" collection of methods. 29 * Typical usage is: 30 * <code> 31 * $authorizedbuyersmarketplaceService = new Google\Service\AuthorizedBuyersMarketplace(...); 32 * $proposals = $authorizedbuyersmarketplaceService->proposals; 33 * </code> 34 */ 35class BuyersProposals extends \Google\Service\Resource 36{ 37 /** 38 * Accepts the proposal at the given revision number. If the revision number in 39 * the request is behind the latest from the server, an error message will be 40 * returned. This call updates the Proposal.state from 41 * `BUYER_ACCEPTANCE_REQUESTED` to `FINALIZED`; it has no side effect if the 42 * Proposal.state is already `FINALIZED` and throws exception if the 43 * Proposal.state is not either `BUYER_ACCEPTANCE_REQUESTED` or `FINALIZED`. 44 * Accepting a proposal means the buyer understands and accepts the 45 * Proposal.terms_and_conditions proposed by the seller. (proposals.accept) 46 * 47 * @param string $name Name of the proposal. Format: 48 * `buyers/{accountId}/proposals/{proposalId}` 49 * @param AcceptProposalRequest $postBody 50 * @param array $optParams Optional parameters. 51 * @return Proposal 52 */ 53 public function accept($name, AcceptProposalRequest $postBody, $optParams = []) 54 { 55 $params = ['name' => $name, 'postBody' => $postBody]; 56 $params = array_merge($params, $optParams); 57 return $this->call('accept', [$params], Proposal::class); 58 } 59 /** 60 * Creates a note for this proposal and sends to the seller. (proposals.addNote) 61 * 62 * @param string $proposal Name of the proposal. Format: 63 * `buyers/{accountId}/proposals/{proposalId}` 64 * @param AddNoteRequest $postBody 65 * @param array $optParams Optional parameters. 66 * @return Proposal 67 */ 68 public function addNote($proposal, AddNoteRequest $postBody, $optParams = []) 69 { 70 $params = ['proposal' => $proposal, 'postBody' => $postBody]; 71 $params = array_merge($params, $optParams); 72 return $this->call('addNote', [$params], Proposal::class); 73 } 74 /** 75 * Cancels an ongoing negotiation on a proposal. This does not cancel or end 76 * serving for the deals if the proposal has been finalized. If the proposal has 77 * not been finalized before, calling this method will set the Proposal.state to 78 * `TERMINATED` and increment the Proposal.proposal_revision. If the proposal 79 * has been finalized before and is under renegotiation now, calling this method 80 * will reset the Proposal.state to `FINALIZED` and increment the 81 * Proposal.proposal_revision. This method does not support private auction 82 * proposals whose Proposal.deal_type is 'PRIVATE_AUCTION'. 83 * (proposals.cancelNegotiation) 84 * 85 * @param string $proposal Name of the proposal. Format: 86 * `buyers/{accountId}/proposals/{proposalId}` 87 * @param CancelNegotiationRequest $postBody 88 * @param array $optParams Optional parameters. 89 * @return Proposal 90 */ 91 public function cancelNegotiation($proposal, CancelNegotiationRequest $postBody, $optParams = []) 92 { 93 $params = ['proposal' => $proposal, 'postBody' => $postBody]; 94 $params = array_merge($params, $optParams); 95 return $this->call('cancelNegotiation', [$params], Proposal::class); 96 } 97 /** 98 * Gets a proposal using its name. The proposal is returned at most recent 99 * revision. revision. (proposals.get) 100 * 101 * @param string $name Required. Name of the proposal. Format: 102 * `buyers/{accountId}/proposals/{proposalId}` 103 * @param array $optParams Optional parameters. 104 * @return Proposal 105 */ 106 public function get($name, $optParams = []) 107 { 108 $params = ['name' => $name]; 109 $params = array_merge($params, $optParams); 110 return $this->call('get', [$params], Proposal::class); 111 } 112 /** 113 * Lists proposals. A filter expression (list filter syntax) may be specified to 114 * filter the results. This will not list finalized versions of proposals that 115 * are being renegotiated; to retrieve these use the finalizedProposals 116 * resource. (proposals.listBuyersProposals) 117 * 118 * @param string $parent Required. Parent that owns the collection of proposals 119 * Format: `buyers/{accountId}` 120 * @param array $optParams Optional parameters. 121 * 122 * @opt_param string filter Optional query string using the [Cloud API list 123 * filtering syntax](https://developers.google.com/authorized- 124 * buyers/apis/guides/v2/list-filters) Supported columns for filtering are: * 125 * displayName * dealType * updateTime * state 126 * @opt_param int pageSize Requested page size. The server may return fewer 127 * results than requested. If unspecified, the server will put a size of 500. 128 * @opt_param string pageToken The page token as returned from 129 * ListProposalsResponse. 130 * @return ListProposalsResponse 131 */ 132 public function listBuyersProposals($parent, $optParams = []) 133 { 134 $params = ['parent' => $parent]; 135 $params = array_merge($params, $optParams); 136 return $this->call('list', [$params], ListProposalsResponse::class); 137 } 138 /** 139 * Updates the proposal at the given revision number. If the revision number in 140 * the request is behind the latest from the server, an error message will be 141 * returned. See FieldMask for how to use FieldMask. Only fields specified in 142 * the UpdateProposalRequest.update_mask will be updated; Fields noted as 143 * 'Immutable' or 'Output only' yet specified in the 144 * UpdateProposalRequest.update_mask will be ignored and left unchanged. 145 * Updating a private auction proposal is not allowed and will result in an 146 * error. (proposals.patch) 147 * 148 * @param string $name Immutable. The name of the proposal serving as a unique 149 * identifier. Format: buyers/{accountId}/proposals/{proposalId} 150 * @param Proposal $postBody 151 * @param array $optParams Optional parameters. 152 * 153 * @opt_param string updateMask List of fields to be updated. If empty or 154 * unspecified, the service will update all fields populated in the update 155 * request excluding the output only fields and primitive fields with default 156 * value. Note that explicit field mask is required in order to reset a 157 * primitive field back to its default value, for example, false for boolean 158 * fields, 0 for integer fields. A special field mask consisting of a single 159 * path "*" can be used to indicate full replacement(the equivalent of PUT 160 * method), updatable fields unset or unspecified in the input will be cleared 161 * or set to default value. Output only fields will be ignored regardless of the 162 * value of updateMask. 163 * @return Proposal 164 */ 165 public function patch($name, Proposal $postBody, $optParams = []) 166 { 167 $params = ['name' => $name, 'postBody' => $postBody]; 168 $params = array_merge($params, $optParams); 169 return $this->call('patch', [$params], Proposal::class); 170 } 171 /** 172 * Sends a request for proposal (RFP) to a publisher to initiate the negotiation 173 * regarding certain inventory. In the RFP, buyers can specify the deal type, 174 * deal terms, start and end dates, targeting, and a message to the publisher. 175 * Once the RFP is sent, a proposal in `SELLER_REVIEW_REQUESTED` state will be 176 * created and returned in the response. The publisher may review your request 177 * and respond with detailed deals in the proposal. (proposals.sendRfp) 178 * 179 * @param string $buyer Required. The current buyer who is sending the RFP in 180 * the format: `buyers/{accountId}`. 181 * @param SendRfpRequest $postBody 182 * @param array $optParams Optional parameters. 183 * @return Proposal 184 */ 185 public function sendRfp($buyer, SendRfpRequest $postBody, $optParams = []) 186 { 187 $params = ['buyer' => $buyer, 'postBody' => $postBody]; 188 $params = array_merge($params, $optParams); 189 return $this->call('sendRfp', [$params], Proposal::class); 190 } 191} 192 193// Adding a class alias for backwards compatibility with the previous class name. 194class_alias(BuyersProposals::class, 'Google_Service_AuthorizedBuyersMarketplace_Resource_BuyersProposals'); 195