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\AdExchangeBuyer\Resource;
19
20use Google\Service\AdExchangeBuyer\CreateOrdersRequest;
21use Google\Service\AdExchangeBuyer\CreateOrdersResponse;
22use Google\Service\AdExchangeBuyer\GetOrdersResponse;
23use Google\Service\AdExchangeBuyer\Proposal;
24
25/**
26 * The "proposals" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $adexchangebuyerService = new Google\Service\AdExchangeBuyer(...);
30 *   $proposals = $adexchangebuyerService->proposals;
31 *  </code>
32 */
33class Proposals extends \Google\Service\Resource
34{
35  /**
36   * Get a proposal given its id (proposals.get)
37   *
38   * @param string $proposalId Id of the proposal to retrieve.
39   * @param array $optParams Optional parameters.
40   * @return Proposal
41   */
42  public function get($proposalId, $optParams = [])
43  {
44    $params = ['proposalId' => $proposalId];
45    $params = array_merge($params, $optParams);
46    return $this->call('get', [$params], Proposal::class);
47  }
48  /**
49   * Create the given list of proposals (proposals.insert)
50   *
51   * @param CreateOrdersRequest $postBody
52   * @param array $optParams Optional parameters.
53   * @return CreateOrdersResponse
54   */
55  public function insert(CreateOrdersRequest $postBody, $optParams = [])
56  {
57    $params = ['postBody' => $postBody];
58    $params = array_merge($params, $optParams);
59    return $this->call('insert', [$params], CreateOrdersResponse::class);
60  }
61  /**
62   * Update the given proposal. This method supports patch semantics.
63   * (proposals.patch)
64   *
65   * @param string $proposalId The proposal id to update.
66   * @param string $revisionNumber The last known revision number to update. If
67   * the head revision in the marketplace database has since changed, an error
68   * will be thrown. The caller should then fetch the latest proposal at head
69   * revision and retry the update at that revision.
70   * @param string $updateAction The proposed action to take on the proposal. This
71   * field is required and it must be set when updating a proposal.
72   * @param Proposal $postBody
73   * @param array $optParams Optional parameters.
74   * @return Proposal
75   */
76  public function patch($proposalId, $revisionNumber, $updateAction, Proposal $postBody, $optParams = [])
77  {
78    $params = ['proposalId' => $proposalId, 'revisionNumber' => $revisionNumber, 'updateAction' => $updateAction, 'postBody' => $postBody];
79    $params = array_merge($params, $optParams);
80    return $this->call('patch', [$params], Proposal::class);
81  }
82  /**
83   * Search for proposals using pql query (proposals.search)
84   *
85   * @param array $optParams Optional parameters.
86   *
87   * @opt_param string pqlQuery Query string to retrieve specific proposals.
88   * @return GetOrdersResponse
89   */
90  public function search($optParams = [])
91  {
92    $params = [];
93    $params = array_merge($params, $optParams);
94    return $this->call('search', [$params], GetOrdersResponse::class);
95  }
96  /**
97   * Update the given proposal to indicate that setup has been completed.
98   * (proposals.setupcomplete)
99   *
100   * @param string $proposalId The proposal id for which the setup is complete
101   * @param array $optParams Optional parameters.
102   */
103  public function setupcomplete($proposalId, $optParams = [])
104  {
105    $params = ['proposalId' => $proposalId];
106    $params = array_merge($params, $optParams);
107    return $this->call('setupcomplete', [$params]);
108  }
109  /**
110   * Update the given proposal (proposals.update)
111   *
112   * @param string $proposalId The proposal id to update.
113   * @param string $revisionNumber The last known revision number to update. If
114   * the head revision in the marketplace database has since changed, an error
115   * will be thrown. The caller should then fetch the latest proposal at head
116   * revision and retry the update at that revision.
117   * @param string $updateAction The proposed action to take on the proposal. This
118   * field is required and it must be set when updating a proposal.
119   * @param Proposal $postBody
120   * @param array $optParams Optional parameters.
121   * @return Proposal
122   */
123  public function update($proposalId, $revisionNumber, $updateAction, Proposal $postBody, $optParams = [])
124  {
125    $params = ['proposalId' => $proposalId, 'revisionNumber' => $revisionNumber, 'updateAction' => $updateAction, 'postBody' => $postBody];
126    $params = array_merge($params, $optParams);
127    return $this->call('update', [$params], Proposal::class);
128  }
129}
130
131// Adding a class alias for backwards compatibility with the previous class name.
132class_alias(Proposals::class, 'Google_Service_AdExchangeBuyer_Resource_Proposals');
133