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\AddCreativeRequest; 21use Google\Service\AuthorizedBuyersMarketplace\FinalizedDeal; 22use Google\Service\AuthorizedBuyersMarketplace\ListFinalizedDealsResponse; 23use Google\Service\AuthorizedBuyersMarketplace\PauseFinalizedDealRequest; 24use Google\Service\AuthorizedBuyersMarketplace\ResumeFinalizedDealRequest; 25use Google\Service\AuthorizedBuyersMarketplace\SetReadyToServeRequest; 26 27/** 28 * The "finalizedDeals" collection of methods. 29 * Typical usage is: 30 * <code> 31 * $authorizedbuyersmarketplaceService = new Google\Service\AuthorizedBuyersMarketplace(...); 32 * $finalizedDeals = $authorizedbuyersmarketplaceService->finalizedDeals; 33 * </code> 34 */ 35class BuyersFinalizedDeals extends \Google\Service\Resource 36{ 37 /** 38 * Add creative to be used in the bidding process for a finalized deal. For 39 * programmatic guaranteed deals, it's recommended that you associate at least 40 * one approved creative with the deal before calling SetReadyToServe, to help 41 * reduce the number of bid responses filtered because they don't contain 42 * approved creatives. Creatives successfully added to a deal can be found in 43 * the Realtime-bidding Creatives API creative.deal_ids. This method only 44 * applies to programmatic guaranteed deals. Maximum number of 1000 creatives 45 * can be added to a finalized deal. (finalizedDeals.addCreative) 46 * 47 * @param string $deal Required. Name of the finalized deal in the format of: 48 * `buyers/{accountId}/finalizedDeals/{dealId}` 49 * @param AddCreativeRequest $postBody 50 * @param array $optParams Optional parameters. 51 * @return FinalizedDeal 52 */ 53 public function addCreative($deal, AddCreativeRequest $postBody, $optParams = []) 54 { 55 $params = ['deal' => $deal, 'postBody' => $postBody]; 56 $params = array_merge($params, $optParams); 57 return $this->call('addCreative', [$params], FinalizedDeal::class); 58 } 59 /** 60 * Gets a finalized deal given its name. (finalizedDeals.get) 61 * 62 * @param string $name Required. Format: 63 * `buyers/{accountId}/finalizedDeals/{dealId}` 64 * @param array $optParams Optional parameters. 65 * @return FinalizedDeal 66 */ 67 public function get($name, $optParams = []) 68 { 69 $params = ['name' => $name]; 70 $params = array_merge($params, $optParams); 71 return $this->call('get', [$params], FinalizedDeal::class); 72 } 73 /** 74 * Lists finalized deals. Use the URL path 75 * "/v1/buyers/{accountId}/finalizedDeals" to list finalized deals for the 76 * current buyer and its clients. Bidders can use the URL path 77 * "/v1/bidders/{accountId}/finalizedDeals" to list finalized deals for the 78 * bidder, its buyers and all their clients. 79 * (finalizedDeals.listBuyersFinalizedDeals) 80 * 81 * @param string $parent Required. The buyer to list the finalized deals for, in 82 * the format: `buyers/{accountId}`. When used to list finalized deals for a 83 * bidder, its buyers and clients, in the format `bidders/{accountId}`. 84 * @param array $optParams Optional parameters. 85 * 86 * @opt_param string filter Optional query string using the [Cloud API list 87 * filtering syntax](https://developers.google.com/authorized- 88 * buyers/apis/guides/v2/list-filters) Supported columns for filtering are: * 89 * deal.displayName * deal.dealType * deal.createTime * deal.updateTime * 90 * deal.flightStartTime * deal.flightEndTime * dealServingStatus 91 * @opt_param string orderBy An optional query string to sort finalized deals 92 * using the [Cloud API sorting 93 * syntax](https://cloud.google.com/apis/design/design_patterns#sorting_order). 94 * If no sort order is specified, results will be returned in an arbitrary 95 * order. Supported columns for sorting are: * deal.displayName * 96 * deal.createTime * deal.updateTime * deal.flightStartTime * deal.flightEndTime 97 * * rtbMetrics.bidRequests7Days * rtbMetrics.bids7Days * 98 * rtbMetrics.adImpressions7Days * rtbMetrics.bidRate7Days * 99 * rtbMetrics.filteredBidRate7Days * rtbMetrics.mustBidRateCurrentMonth Example: 100 * 'deal.displayName, deal.updateTime desc' 101 * @opt_param int pageSize Requested page size. The server may return fewer 102 * results than requested. If requested more than 500, the server will return 103 * 500 results per page. If unspecified, the server will pick a default page 104 * size of 100. 105 * @opt_param string pageToken The page token as returned from 106 * ListFinalizedDealsResponse. 107 * @return ListFinalizedDealsResponse 108 */ 109 public function listBuyersFinalizedDeals($parent, $optParams = []) 110 { 111 $params = ['parent' => $parent]; 112 $params = array_merge($params, $optParams); 113 return $this->call('list', [$params], ListFinalizedDealsResponse::class); 114 } 115 /** 116 * Pauses serving of the given finalized deal. This call only pauses the serving 117 * status, and does not affect other fields of the finalized deal. Calling this 118 * method for an already paused deal has no effect. This method only applies to 119 * programmatic guaranteed deals. (finalizedDeals.pause) 120 * 121 * @param string $name Required. Format: 122 * `buyers/{accountId}/finalizedDeals/{dealId}` 123 * @param PauseFinalizedDealRequest $postBody 124 * @param array $optParams Optional parameters. 125 * @return FinalizedDeal 126 */ 127 public function pause($name, PauseFinalizedDealRequest $postBody, $optParams = []) 128 { 129 $params = ['name' => $name, 'postBody' => $postBody]; 130 $params = array_merge($params, $optParams); 131 return $this->call('pause', [$params], FinalizedDeal::class); 132 } 133 /** 134 * Resumes serving of the given finalized deal. Calling this method for an 135 * running deal has no effect. If a deal is initially paused by the seller, 136 * calling this method will not resume serving of the deal until the seller also 137 * resumes the deal. This method only applies to programmatic guaranteed deals. 138 * (finalizedDeals.resume) 139 * 140 * @param string $name Required. Format: 141 * `buyers/{accountId}/finalizedDeals/{dealId}` 142 * @param ResumeFinalizedDealRequest $postBody 143 * @param array $optParams Optional parameters. 144 * @return FinalizedDeal 145 */ 146 public function resume($name, ResumeFinalizedDealRequest $postBody, $optParams = []) 147 { 148 $params = ['name' => $name, 'postBody' => $postBody]; 149 $params = array_merge($params, $optParams); 150 return $this->call('resume', [$params], FinalizedDeal::class); 151 } 152 /** 153 * Sets the given finalized deal as ready to serve. By default, deals are ready 154 * to serve as soon as they're finalized. A bidder can opt out of this feature 155 * by asking to be included in an allowlist. Once opted out, finalized deals 156 * belonging to the bidder and its child seats will not start serving until this 157 * method is called. This method is useful to the bidders who prefer to not 158 * receive bid requests before the creative is ready. This method only applies 159 * to programmatic guaranteed deals. (finalizedDeals.setReadyToServe) 160 * 161 * @param string $deal Required. Format: 162 * `buyers/{accountId}/finalizedDeals/{dealId}` 163 * @param SetReadyToServeRequest $postBody 164 * @param array $optParams Optional parameters. 165 * @return FinalizedDeal 166 */ 167 public function setReadyToServe($deal, SetReadyToServeRequest $postBody, $optParams = []) 168 { 169 $params = ['deal' => $deal, 'postBody' => $postBody]; 170 $params = array_merge($params, $optParams); 171 return $this->call('setReadyToServe', [$params], FinalizedDeal::class); 172 } 173} 174 175// Adding a class alias for backwards compatibility with the previous class name. 176class_alias(BuyersFinalizedDeals::class, 'Google_Service_AuthorizedBuyersMarketplace_Resource_BuyersFinalizedDeals'); 177