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\DisplayVideo\Resource; 19 20use Google\Service\DisplayVideo\CustomBiddingAlgorithm; 21use Google\Service\DisplayVideo\CustomBiddingScriptRef; 22use Google\Service\DisplayVideo\ListCustomBiddingAlgorithmsResponse; 23 24/** 25 * The "customBiddingAlgorithms" collection of methods. 26 * Typical usage is: 27 * <code> 28 * $displayvideoService = new Google\Service\DisplayVideo(...); 29 * $customBiddingAlgorithms = $displayvideoService->customBiddingAlgorithms; 30 * </code> 31 */ 32class CustomBiddingAlgorithms extends \Google\Service\Resource 33{ 34 /** 35 * Creates a new custom bidding algorithm. Returns the newly created custom 36 * bidding algorithm if successful. (customBiddingAlgorithms.create) 37 * 38 * @param CustomBiddingAlgorithm $postBody 39 * @param array $optParams Optional parameters. 40 * @return CustomBiddingAlgorithm 41 */ 42 public function create(CustomBiddingAlgorithm $postBody, $optParams = []) 43 { 44 $params = ['postBody' => $postBody]; 45 $params = array_merge($params, $optParams); 46 return $this->call('create', [$params], CustomBiddingAlgorithm::class); 47 } 48 /** 49 * Gets a custom bidding algorithm. (customBiddingAlgorithms.get) 50 * 51 * @param string $customBiddingAlgorithmId Required. The ID of the custom 52 * bidding algorithm to fetch. 53 * @param array $optParams Optional parameters. 54 * 55 * @opt_param string advertiserId The ID of the DV360 partner that has access to 56 * the custom bidding algorithm. 57 * @opt_param string partnerId The ID of the DV360 partner that has access to 58 * the custom bidding algorithm. 59 * @return CustomBiddingAlgorithm 60 */ 61 public function get($customBiddingAlgorithmId, $optParams = []) 62 { 63 $params = ['customBiddingAlgorithmId' => $customBiddingAlgorithmId]; 64 $params = array_merge($params, $optParams); 65 return $this->call('get', [$params], CustomBiddingAlgorithm::class); 66 } 67 /** 68 * Lists custom bidding algorithms that are accessible to the current user and 69 * can be used in bidding stratgies. The order is defined by the order_by 70 * parameter. (customBiddingAlgorithms.listCustomBiddingAlgorithms) 71 * 72 * @param array $optParams Optional parameters. 73 * 74 * @opt_param string advertiserId The ID of the DV360 advertiser that has access 75 * to the custom bidding algorithm. 76 * @opt_param string filter Allows filtering by custom bidding algorithm fields. 77 * Supported syntax: * Filter expressions are made up of one or more 78 * restrictions. * Restrictions can be combined by `AND`. A sequence of 79 * restrictions * implicitly uses `AND`. * A restriction has the form of 80 * `{field} {operator} {value}`. * The operator must be `CONTAINS (:)` or 81 * `EQUALS (=)`. * The operator must be `CONTAINS (:)` for the following field: 82 * - `displayName` * The operator must be `EQUALS (=)` for the following field: 83 * - `customBiddingAlgorithmType` - `customBiddingAlgorithmState` * For 84 * `displayName`, the value is a string. We return all custom bidding algorithms 85 * whose display_name contains such string. * For `customBiddingAlgorithmType`, 86 * the value is a string. We return all algorithms whose 87 * custom_bidding_algorithm_type is equal to the given type. * For 88 * `customBiddingAlgorithmState`, the value is a string. We return all 89 * algorithms whose custom_bidding_algorithm_state is equal to the given type. 90 * Examples: * All custom bidding algorithms for which the display name contains 91 * "politics": `displayName:politics`. * All custom bidding algorithms for which 92 * the type is "SCRIPT_BASED": `customBiddingAlgorithmType=SCRIPT_BASED` * All 93 * custom bidding algorithms for which the state is "ENABLED": 94 * `customBiddingAlgorithmState=ENABLED` The length of this field should be no 95 * more than 500 characters. 96 * @opt_param string orderBy Field by which to sort the list. Acceptable values 97 * are: * `displayName` (default) The default sorting order is ascending. To 98 * specify descending order for a field, a suffix "desc" should be added to the 99 * field name. Example: `displayName desc`. 100 * @opt_param int pageSize Requested page size. Must be between `1` and `100`. 101 * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT` 102 * if an invalid value is specified. 103 * @opt_param string pageToken A token identifying a page of results the server 104 * should return. Typically, this is the value of next_page_token returned from 105 * the previous call to `ListCustomBiddingAlgorithms` method. If not specified, 106 * the first page of results will be returned. 107 * @opt_param string partnerId The ID of the DV360 partner that has access to 108 * the custom bidding algorithm. 109 * @return ListCustomBiddingAlgorithmsResponse 110 */ 111 public function listCustomBiddingAlgorithms($optParams = []) 112 { 113 $params = []; 114 $params = array_merge($params, $optParams); 115 return $this->call('list', [$params], ListCustomBiddingAlgorithmsResponse::class); 116 } 117 /** 118 * Updates an existing custom bidding algorithm. Returns the updated custom 119 * bidding algorithm if successful. (customBiddingAlgorithms.patch) 120 * 121 * @param string $customBiddingAlgorithmId Output only. The unique ID of the 122 * custom bidding algorithm. Assigned by the system. 123 * @param CustomBiddingAlgorithm $postBody 124 * @param array $optParams Optional parameters. 125 * 126 * @opt_param string updateMask Required. The mask to control which fields to 127 * update. 128 * @return CustomBiddingAlgorithm 129 */ 130 public function patch($customBiddingAlgorithmId, CustomBiddingAlgorithm $postBody, $optParams = []) 131 { 132 $params = ['customBiddingAlgorithmId' => $customBiddingAlgorithmId, 'postBody' => $postBody]; 133 $params = array_merge($params, $optParams); 134 return $this->call('patch', [$params], CustomBiddingAlgorithm::class); 135 } 136 /** 137 * Creates a custom bidding script reference object for a script file. The 138 * resulting reference object provides a resource path to which the script file 139 * should be uploaded. This reference object should be included in when creating 140 * a new custom bidding script object. (customBiddingAlgorithms.uploadScript) 141 * 142 * @param string $customBiddingAlgorithmId Required. The ID of the custom 143 * bidding algorithm owns the script. 144 * @param array $optParams Optional parameters. 145 * 146 * @opt_param string advertiserId The ID of the advertiser that owns the parent 147 * custom bidding algorithm. 148 * @opt_param string partnerId The ID of the partner that owns the parent custom 149 * bidding algorithm. Only this partner will have write access to this custom 150 * bidding script. 151 * @return CustomBiddingScriptRef 152 */ 153 public function uploadScript($customBiddingAlgorithmId, $optParams = []) 154 { 155 $params = ['customBiddingAlgorithmId' => $customBiddingAlgorithmId]; 156 $params = array_merge($params, $optParams); 157 return $this->call('uploadScript', [$params], CustomBiddingScriptRef::class); 158 } 159} 160 161// Adding a class alias for backwards compatibility with the previous class name. 162class_alias(CustomBiddingAlgorithms::class, 'Google_Service_DisplayVideo_Resource_CustomBiddingAlgorithms'); 163