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\CustomBiddingScript;
21use Google\Service\DisplayVideo\ListCustomBiddingScriptsResponse;
22
23/**
24 * The "scripts" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $displayvideoService = new Google\Service\DisplayVideo(...);
28 *   $scripts = $displayvideoService->scripts;
29 *  </code>
30 */
31class CustomBiddingAlgorithmsScripts extends \Google\Service\Resource
32{
33  /**
34   * Creates a new custom bidding script. Returns the newly created script if
35   * successful. (scripts.create)
36   *
37   * @param string $customBiddingAlgorithmId Required. The ID of the custom
38   * bidding algorithm that owns the script.
39   * @param CustomBiddingScript $postBody
40   * @param array $optParams Optional parameters.
41   *
42   * @opt_param string advertiserId The ID of the advertiser that owns the parent
43   * custom bidding algorithm.
44   * @opt_param string partnerId The ID of the partner that owns the parent custom
45   * bidding algorithm. Only this partner will have write access to this custom
46   * bidding script.
47   * @return CustomBiddingScript
48   */
49  public function create($customBiddingAlgorithmId, CustomBiddingScript $postBody, $optParams = [])
50  {
51    $params = ['customBiddingAlgorithmId' => $customBiddingAlgorithmId, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('create', [$params], CustomBiddingScript::class);
54  }
55  /**
56   * Gets a custom bidding script. (scripts.get)
57   *
58   * @param string $customBiddingAlgorithmId Required. The ID of the custom
59   * bidding algorithm owns the script.
60   * @param string $customBiddingScriptId Required. The ID of the custom bidding
61   * script to fetch.
62   * @param array $optParams Optional parameters.
63   *
64   * @opt_param string advertiserId The ID of the advertiser that owns the parent
65   * custom bidding algorithm.
66   * @opt_param string partnerId The ID of the partner that owns the parent custom
67   * bidding algorithm. Only this partner will have write access to this custom
68   * bidding script.
69   * @return CustomBiddingScript
70   */
71  public function get($customBiddingAlgorithmId, $customBiddingScriptId, $optParams = [])
72  {
73    $params = ['customBiddingAlgorithmId' => $customBiddingAlgorithmId, 'customBiddingScriptId' => $customBiddingScriptId];
74    $params = array_merge($params, $optParams);
75    return $this->call('get', [$params], CustomBiddingScript::class);
76  }
77  /**
78   * Lists custom bidding scripts that belong to the given algorithm. The order is
79   * defined by the order_by parameter.
80   * (scripts.listCustomBiddingAlgorithmsScripts)
81   *
82   * @param string $customBiddingAlgorithmId Required. The ID of the custom
83   * bidding algorithm owns the script.
84   * @param array $optParams Optional parameters.
85   *
86   * @opt_param string advertiserId The ID of the advertiser that owns the parent
87   * custom bidding algorithm.
88   * @opt_param string orderBy Field by which to sort the list. Acceptable values
89   * are: * `createTime desc` (default) The default sorting order is descending.
90   * To specify ascending order for a field, the suffix "desc" should be removed.
91   * Example: `createTime`.
92   * @opt_param int pageSize Requested page size. Must be between `1` and `100`.
93   * If unspecified will default to `100`. Returns error code `INVALID_ARGUMENT`
94   * if an invalid value is specified.
95   * @opt_param string pageToken A token identifying a page of results the server
96   * should return. Typically, this is the value of next_page_token returned from
97   * the previous call to `ListCustomBiddingScripts` method. If not specified, the
98   * first page of results will be returned.
99   * @opt_param string partnerId The ID of the partner that owns the parent custom
100   * bidding algorithm. Only this partner will have write access to this custom
101   * bidding script.
102   * @return ListCustomBiddingScriptsResponse
103   */
104  public function listCustomBiddingAlgorithmsScripts($customBiddingAlgorithmId, $optParams = [])
105  {
106    $params = ['customBiddingAlgorithmId' => $customBiddingAlgorithmId];
107    $params = array_merge($params, $optParams);
108    return $this->call('list', [$params], ListCustomBiddingScriptsResponse::class);
109  }
110}
111
112// Adding a class alias for backwards compatibility with the previous class name.
113class_alias(CustomBiddingAlgorithmsScripts::class, 'Google_Service_DisplayVideo_Resource_CustomBiddingAlgorithmsScripts');
114