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\ActivateClientUserRequest;
21use Google\Service\AuthorizedBuyersMarketplace\AuthorizedbuyersmarketplaceEmpty;
22use Google\Service\AuthorizedBuyersMarketplace\ClientUser;
23use Google\Service\AuthorizedBuyersMarketplace\DeactivateClientUserRequest;
24use Google\Service\AuthorizedBuyersMarketplace\ListClientUsersResponse;
25
26/**
27 * The "users" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $authorizedbuyersmarketplaceService = new Google\Service\AuthorizedBuyersMarketplace(...);
31 *   $users = $authorizedbuyersmarketplaceService->users;
32 *  </code>
33 */
34class BuyersClientsUsers extends \Google\Service\Resource
35{
36  /**
37   * Activates an existing client user. The state of the client user will be
38   * updated from "INACTIVE" to "ACTIVE". This method has no effect if the client
39   * user is already in "ACTIVE" state. An error will be returned if the client
40   * user to activate is still in "INVITED" state. (users.activate)
41   *
42   * @param string $name Required. Format:
43   * `buyers/{buyerAccountId}/clients/{clientAccountId}/clientUsers/{userId}`
44   * @param ActivateClientUserRequest $postBody
45   * @param array $optParams Optional parameters.
46   * @return ClientUser
47   */
48  public function activate($name, ActivateClientUserRequest $postBody, $optParams = [])
49  {
50    $params = ['name' => $name, 'postBody' => $postBody];
51    $params = array_merge($params, $optParams);
52    return $this->call('activate', [$params], ClientUser::class);
53  }
54  /**
55   * Creates a new client user in "INVITED" state. An email invitation will be
56   * sent to the new user, once accepted the user will become active.
57   * (users.create)
58   *
59   * @param string $parent Required. The name of the client. Format:
60   * `buyers/{accountId}/clients/{clientAccountId}`
61   * @param ClientUser $postBody
62   * @param array $optParams Optional parameters.
63   * @return ClientUser
64   */
65  public function create($parent, ClientUser $postBody, $optParams = [])
66  {
67    $params = ['parent' => $parent, 'postBody' => $postBody];
68    $params = array_merge($params, $optParams);
69    return $this->call('create', [$params], ClientUser::class);
70  }
71  /**
72   * Deactivates an existing client user. The state of the client user will be
73   * updated from "ACTIVE" to "INACTIVE". This method has no effect if the client
74   * user is already in "INACTIVE" state. An error will be returned if the client
75   * user to deactivate is still in "INVITED" state. (users.deactivate)
76   *
77   * @param string $name Required. Format:
78   * `buyers/{buyerAccountId}/clients/{clientAccountId}/clientUsers/{userId}`
79   * @param DeactivateClientUserRequest $postBody
80   * @param array $optParams Optional parameters.
81   * @return ClientUser
82   */
83  public function deactivate($name, DeactivateClientUserRequest $postBody, $optParams = [])
84  {
85    $params = ['name' => $name, 'postBody' => $postBody];
86    $params = array_merge($params, $optParams);
87    return $this->call('deactivate', [$params], ClientUser::class);
88  }
89  /**
90   * Deletes an existing client user. The client user will lose access to the
91   * Authorized Buyers UI. Note that if a client user is deleted, the user's
92   * access to the UI can't be restored unless a new client user is created and
93   * activated. (users.delete)
94   *
95   * @param string $name Required. Format:
96   * `buyers/{buyerAccountId}/clients/{clientAccountId}/clientUsers/{userId}`
97   * @param array $optParams Optional parameters.
98   * @return AuthorizedbuyersmarketplaceEmpty
99   */
100  public function delete($name, $optParams = [])
101  {
102    $params = ['name' => $name];
103    $params = array_merge($params, $optParams);
104    return $this->call('delete', [$params], AuthorizedbuyersmarketplaceEmpty::class);
105  }
106  /**
107   * Retrieves an existing client user. (users.get)
108   *
109   * @param string $name Required. Format:
110   * `buyers/{buyerAccountId}/clients/{clientAccountId}/clientUsers/{userId}`
111   * @param array $optParams Optional parameters.
112   * @return ClientUser
113   */
114  public function get($name, $optParams = [])
115  {
116    $params = ['name' => $name];
117    $params = array_merge($params, $optParams);
118    return $this->call('get', [$params], ClientUser::class);
119  }
120  /**
121   * Lists all client users for a specified client. (users.listBuyersClientsUsers)
122   *
123   * @param string $parent Required. The name of the client. Format:
124   * `buyers/{buyerAccountId}/clients/{clientAccountId}`
125   * @param array $optParams Optional parameters.
126   *
127   * @opt_param int pageSize Requested page size. If left blank, a default page
128   * size of 500 will be applied.
129   * @opt_param string pageToken A token identifying a page of results the server
130   * should return. Typically, this is the value of
131   * ListClientUsersResponse.nextPageToken returned from the previous call to the
132   * list method.
133   * @return ListClientUsersResponse
134   */
135  public function listBuyersClientsUsers($parent, $optParams = [])
136  {
137    $params = ['parent' => $parent];
138    $params = array_merge($params, $optParams);
139    return $this->call('list', [$params], ListClientUsersResponse::class);
140  }
141}
142
143// Adding a class alias for backwards compatibility with the previous class name.
144class_alias(BuyersClientsUsers::class, 'Google_Service_AuthorizedBuyersMarketplace_Resource_BuyersClientsUsers');
145