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\ActivateClientRequest;
21use Google\Service\AuthorizedBuyersMarketplace\Client;
22use Google\Service\AuthorizedBuyersMarketplace\DeactivateClientRequest;
23use Google\Service\AuthorizedBuyersMarketplace\ListClientsResponse;
24
25/**
26 * The "clients" collection of methods.
27 * Typical usage is:
28 *  <code>
29 *   $authorizedbuyersmarketplaceService = new Google\Service\AuthorizedBuyersMarketplace(...);
30 *   $clients = $authorizedbuyersmarketplaceService->clients;
31 *  </code>
32 */
33class BuyersClients extends \Google\Service\Resource
34{
35  /**
36   * Activates an existing client. The state of the client will be updated to
37   * "ACTIVE". This method has no effect if the client is already in "ACTIVE"
38   * state. (clients.activate)
39   *
40   * @param string $name Required. Format:
41   * `buyers/{buyerAccountId}/clients/{clientAccountId}`
42   * @param ActivateClientRequest $postBody
43   * @param array $optParams Optional parameters.
44   * @return Client
45   */
46  public function activate($name, ActivateClientRequest $postBody, $optParams = [])
47  {
48    $params = ['name' => $name, 'postBody' => $postBody];
49    $params = array_merge($params, $optParams);
50    return $this->call('activate', [$params], Client::class);
51  }
52  /**
53   * Creates a new client. (clients.create)
54   *
55   * @param string $parent Required. The name of the buyer. Format:
56   * `buyers/{accountId}`
57   * @param Client $postBody
58   * @param array $optParams Optional parameters.
59   * @return Client
60   */
61  public function create($parent, Client $postBody, $optParams = [])
62  {
63    $params = ['parent' => $parent, 'postBody' => $postBody];
64    $params = array_merge($params, $optParams);
65    return $this->call('create', [$params], Client::class);
66  }
67  /**
68   * Deactivates an existing client. The state of the client will be updated to
69   * "INACTIVE". This method has no effect if the client is already in "INACTIVE"
70   * state. (clients.deactivate)
71   *
72   * @param string $name Required. Format:
73   * `buyers/{buyerAccountId}/clients/{clientAccountId}`
74   * @param DeactivateClientRequest $postBody
75   * @param array $optParams Optional parameters.
76   * @return Client
77   */
78  public function deactivate($name, DeactivateClientRequest $postBody, $optParams = [])
79  {
80    $params = ['name' => $name, 'postBody' => $postBody];
81    $params = array_merge($params, $optParams);
82    return $this->call('deactivate', [$params], Client::class);
83  }
84  /**
85   * Gets a client with a given resource name. (clients.get)
86   *
87   * @param string $name Required. Format:
88   * `buyers/{accountId}/clients/{clientAccountId}`
89   * @param array $optParams Optional parameters.
90   * @return Client
91   */
92  public function get($name, $optParams = [])
93  {
94    $params = ['name' => $name];
95    $params = array_merge($params, $optParams);
96    return $this->call('get', [$params], Client::class);
97  }
98  /**
99   * Lists all the clients for the current buyer. (clients.listBuyersClients)
100   *
101   * @param string $parent Required. The name of the buyer. Format:
102   * `buyers/{accountId}`
103   * @param array $optParams Optional parameters.
104   *
105   * @opt_param string filter Query string using the [Filtering
106   * Syntax](https://developers.google.com/authorized-buyers/apis/guides/v2/list-
107   * filters) Supported fields for filtering are: * partnerClientId Use this field
108   * to filter the clients by the partnerClientId. For example, if the
109   * partnerClientId of the client is "1234", the value of this field should be
110   * `partnerClientId = "1234"`, in order to get only the client whose
111   * partnerClientId is "1234" in the response.
112   * @opt_param int pageSize Requested page size. If left blank, a default page
113   * size of 500 will be applied.
114   * @opt_param string pageToken A token identifying a page of results the server
115   * should return. Typically, this is the value of
116   * ListClientsResponse.nextPageToken returned from the previous call to the list
117   * method.
118   * @return ListClientsResponse
119   */
120  public function listBuyersClients($parent, $optParams = [])
121  {
122    $params = ['parent' => $parent];
123    $params = array_merge($params, $optParams);
124    return $this->call('list', [$params], ListClientsResponse::class);
125  }
126  /**
127   * Updates an existing client. (clients.patch)
128   *
129   * @param string $name Output only. The resource name of the client. Format:
130   * `buyers/{accountId}/clients/{clientAccountId}`
131   * @param Client $postBody
132   * @param array $optParams Optional parameters.
133   *
134   * @opt_param string updateMask List of fields to be updated. If empty or
135   * unspecified, the service will update all fields populated in the update
136   * request excluding the output only fields and primitive fields with default
137   * value. Note that explicit field mask is required in order to reset a
138   * primitive field back to its default value, for example, false for boolean
139   * fields, 0 for integer fields. A special field mask consisting of a single
140   * path "*" can be used to indicate full replacement(the equivalent of PUT
141   * method), updatable fields unset or unspecified in the input will be cleared
142   * or set to default value. Output only fields will be ignored regardless of the
143   * value of updateMask.
144   * @return Client
145   */
146  public function patch($name, Client $postBody, $optParams = [])
147  {
148    $params = ['name' => $name, 'postBody' => $postBody];
149    $params = array_merge($params, $optParams);
150    return $this->call('patch', [$params], Client::class);
151  }
152}
153
154// Adding a class alias for backwards compatibility with the previous class name.
155class_alias(BuyersClients::class, 'Google_Service_AuthorizedBuyersMarketplace_Resource_BuyersClients');
156