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\BatchUpdateDealsRequest; 21use Google\Service\AuthorizedBuyersMarketplace\BatchUpdateDealsResponse; 22use Google\Service\AuthorizedBuyersMarketplace\Deal; 23use Google\Service\AuthorizedBuyersMarketplace\ListDealsResponse; 24 25/** 26 * The "deals" collection of methods. 27 * Typical usage is: 28 * <code> 29 * $authorizedbuyersmarketplaceService = new Google\Service\AuthorizedBuyersMarketplace(...); 30 * $deals = $authorizedbuyersmarketplaceService->deals; 31 * </code> 32 */ 33class BuyersProposalsDeals extends \Google\Service\Resource 34{ 35 /** 36 * Batch updates multiple deals in the same proposal. (deals.batchUpdate) 37 * 38 * @param string $parent Required. The name of the proposal containing the deals 39 * to batch update. Format: buyers/{accountId}/proposals/{proposalId} 40 * @param BatchUpdateDealsRequest $postBody 41 * @param array $optParams Optional parameters. 42 * @return BatchUpdateDealsResponse 43 */ 44 public function batchUpdate($parent, BatchUpdateDealsRequest $postBody, $optParams = []) 45 { 46 $params = ['parent' => $parent, 'postBody' => $postBody]; 47 $params = array_merge($params, $optParams); 48 return $this->call('batchUpdate', [$params], BatchUpdateDealsResponse::class); 49 } 50 /** 51 * Gets a deal given its name. The deal is returned at its head revision. 52 * (deals.get) 53 * 54 * @param string $name Required. Format: 55 * buyers/{accountId}/proposals/{proposalId}/deals/{dealId} 56 * @param array $optParams Optional parameters. 57 * @return Deal 58 */ 59 public function get($name, $optParams = []) 60 { 61 $params = ['name' => $name]; 62 $params = array_merge($params, $optParams); 63 return $this->call('get', [$params], Deal::class); 64 } 65 /** 66 * Lists all deals in a proposal. To retrieve only the finalized revision deals 67 * regardless if a deal is being renegotiated, see the FinalizedDeals resource. 68 * (deals.listBuyersProposalsDeals) 69 * 70 * @param string $parent Required. The name of the proposal containing the deals 71 * to retrieve. Format: buyers/{accountId}/proposals/{proposalId} 72 * @param array $optParams Optional parameters. 73 * 74 * @opt_param int pageSize Requested page size. The server may return fewer 75 * results than requested. If requested more than 500, the server will return 76 * 500 results per page. If unspecified, the server will pick a default page 77 * size of 100. 78 * @opt_param string pageToken The page token as returned from 79 * ListDealsResponse. 80 * @return ListDealsResponse 81 */ 82 public function listBuyersProposalsDeals($parent, $optParams = []) 83 { 84 $params = ['parent' => $parent]; 85 $params = array_merge($params, $optParams); 86 return $this->call('list', [$params], ListDealsResponse::class); 87 } 88 /** 89 * Updates the given deal at the buyer known revision number. If the server 90 * revision has advanced since the passed-in proposal.proposal_revision an 91 * ABORTED error message will be returned. The revision number is incremented by 92 * the server whenever the proposal or its constituent deals are updated. Note: 93 * The revision number is kept at a proposal level. The buyer of the API is 94 * expected to keep track of the revision number after the last update operation 95 * and send it in as part of the next update request. This way, if there are 96 * further changes on the server (for example, seller making new updates), then 97 * the server can detect conflicts and reject the proposed changes. 98 * (deals.patch) 99 * 100 * @param string $name Immutable. The unique identifier of the deal. Auto- 101 * generated by the server when a deal is created. Format: 102 * buyers/{accountId}/proposals/{proposalId}/deals/{dealId} 103 * @param Deal $postBody 104 * @param array $optParams Optional parameters. 105 * 106 * @opt_param string updateMask List of fields to be updated. If empty or 107 * unspecified, the service will update all fields populated in the update 108 * request excluding the output only fields and primitive fields with default 109 * value. Note that explicit field mask is required in order to reset a 110 * primitive field back to its default value, for example, false for boolean 111 * fields, 0 for integer fields. A special field mask consisting of a single 112 * path "*" can be used to indicate full replacement(the equivalent of PUT 113 * method), updatable fields unset or unspecified in the input will be cleared 114 * or set to default value. Output only fields will be ignored regardless of the 115 * value of updateMask. 116 * @return Deal 117 */ 118 public function patch($name, Deal $postBody, $optParams = []) 119 { 120 $params = ['name' => $name, 'postBody' => $postBody]; 121 $params = array_merge($params, $optParams); 122 return $this->call('patch', [$params], Deal::class); 123 } 124} 125 126// Adding a class alias for backwards compatibility with the previous class name. 127class_alias(BuyersProposalsDeals::class, 'Google_Service_AuthorizedBuyersMarketplace_Resource_BuyersProposalsDeals'); 128