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
18/**
19 * The "users" collection of methods.
20 * Typical usage is:
21 *  <code>
22 *   $adminService = new Google_Service_Directory(...);
23 *   $users = $adminService->users;
24 *  </code>
25 */
26class Google_Service_Directory_Resource_Users extends Google_Service_Resource
27{
28  /**
29   * Deletes a user. (users.delete)
30   *
31   * @param string $userKey Identifies the user in the API request. The value can
32   * be the user's primary email address, alias email address, or unique user ID.
33   * @param array $optParams Optional parameters.
34   */
35  public function delete($userKey, $optParams = array())
36  {
37    $params = array('userKey' => $userKey);
38    $params = array_merge($params, $optParams);
39    return $this->call('delete', array($params));
40  }
41  /**
42   * Retrieves a user. (users.get)
43   *
44   * @param string $userKey Identifies the user in the API request. The value can
45   * be the user's primary email address, alias email address, or unique user ID.
46   * @param array $optParams Optional parameters.
47   *
48   * @opt_param string customFieldMask A comma-separated list of schema names. All
49   * fields from these schemas are fetched. This should only be set when
50   * `projection=custom`.
51   * @opt_param string projection What subset of fields to fetch for this user.
52   * @opt_param string viewType Whether to fetch the administrator-only or domain-
53   * wide public view of the user. For more information, see [Retrieve a user as a
54   * non-administrator](/admin-sdk/directory/v1/guides/manage-
55   * users#retrieve_users_non_admin).
56   * @return Google_Service_Directory_User
57   */
58  public function get($userKey, $optParams = array())
59  {
60    $params = array('userKey' => $userKey);
61    $params = array_merge($params, $optParams);
62    return $this->call('get', array($params), "Google_Service_Directory_User");
63  }
64  /**
65   * Creates a user. (users.insert)
66   *
67   * @param Google_Service_Directory_User $postBody
68   * @param array $optParams Optional parameters.
69   * @return Google_Service_Directory_User
70   */
71  public function insert(Google_Service_Directory_User $postBody, $optParams = array())
72  {
73    $params = array('postBody' => $postBody);
74    $params = array_merge($params, $optParams);
75    return $this->call('insert', array($params), "Google_Service_Directory_User");
76  }
77  /**
78   * Retrieves a paginated list of either deleted users or all users in a domain.
79   * (users.listUsers)
80   *
81   * @param array $optParams Optional parameters.
82   *
83   * @opt_param string customFieldMask A comma-separated list of schema names. All
84   * fields from these schemas are fetched. This should only be set when
85   * `projection=custom`.
86   * @opt_param string customer The unique ID for the customer's Google Workspace
87   * account. In case of a multi-domain account, to fetch all groups for a
88   * customer, fill this field instead of domain. You can also use the
89   * `my_customer` alias to represent your account's `customerId`. The
90   * `customerId` is also returned as part of the [Users resource](/admin-
91   * sdk/directory/v1/reference/users). Either the `customer` or the `domain`
92   * parameter must be provided.
93   * @opt_param string domain The domain name. Use this field to get fields from
94   * only one domain. To return all domains for a customer account, use the
95   * `customer` query parameter instead. Either the `customer` or the `domain`
96   * parameter must be provided.
97   * @opt_param string event Event on which subscription is intended (if
98   * subscribing)
99   * @opt_param int maxResults Maximum number of results to return.
100   * @opt_param string orderBy Property to use for sorting results.
101   * @opt_param string pageToken Token to specify next page in the list
102   * @opt_param string projection What subset of fields to fetch for this user.
103   * @opt_param string query Query string for searching user fields. For more
104   * information on constructing user queries, see [Search for Users](/admin-
105   * sdk/directory/v1/guides/search-users).
106   * @opt_param string showDeleted If set to `true`, retrieves the list of deleted
107   * users. (Default: `false`)
108   * @opt_param string sortOrder Whether to return results in ascending or
109   * descending order.
110   * @opt_param string viewType Whether to fetch the administrator-only or domain-
111   * wide public view of the user. For more information, see [Retrieve a user as a
112   * non-administrator](/admin-sdk/directory/v1/guides/manage-
113   * users#retrieve_users_non_admin).
114   * @return Google_Service_Directory_Users
115   */
116  public function listUsers($optParams = array())
117  {
118    $params = array();
119    $params = array_merge($params, $optParams);
120    return $this->call('list', array($params), "Google_Service_Directory_Users");
121  }
122  /**
123   * Makes a user a super administrator. (users.makeAdmin)
124   *
125   * @param string $userKey Identifies the user in the API request. The value can
126   * be the user's primary email address, alias email address, or unique user ID.
127   * @param Google_Service_Directory_UserMakeAdmin $postBody
128   * @param array $optParams Optional parameters.
129   */
130  public function makeAdmin($userKey, Google_Service_Directory_UserMakeAdmin $postBody, $optParams = array())
131  {
132    $params = array('userKey' => $userKey, 'postBody' => $postBody);
133    $params = array_merge($params, $optParams);
134    return $this->call('makeAdmin', array($params));
135  }
136  /**
137   * Updates a user using patch semantics. The update method should be used
138   * instead, since it also supports patch semantics and has better performance.
139   * This method is unable to clear fields that contain repeated objects
140   * (`addresses`, `phones`, etc). Use the update method instead. (users.patch)
141   *
142   * @param string $userKey Identifies the user in the API request. The value can
143   * be the user's primary email address, alias email address, or unique user ID.
144   * @param Google_Service_Directory_User $postBody
145   * @param array $optParams Optional parameters.
146   * @return Google_Service_Directory_User
147   */
148  public function patch($userKey, Google_Service_Directory_User $postBody, $optParams = array())
149  {
150    $params = array('userKey' => $userKey, 'postBody' => $postBody);
151    $params = array_merge($params, $optParams);
152    return $this->call('patch', array($params), "Google_Service_Directory_User");
153  }
154  /**
155   * Sign a user out of all web and device sessions and reset their sign-in
156   * cookies. User will have to sign in by authenticating again. (users.signOut)
157   *
158   * @param string $userKey Identifies the target user in the API request. The
159   * value can be the user's primary email address, alias email address, or unique
160   * user ID.
161   * @param array $optParams Optional parameters.
162   */
163  public function signOut($userKey, $optParams = array())
164  {
165    $params = array('userKey' => $userKey);
166    $params = array_merge($params, $optParams);
167    return $this->call('signOut', array($params));
168  }
169  /**
170   * Undeletes a deleted user. (users.undelete)
171   *
172   * @param string $userKey The immutable id of the user
173   * @param Google_Service_Directory_UserUndelete $postBody
174   * @param array $optParams Optional parameters.
175   */
176  public function undelete($userKey, Google_Service_Directory_UserUndelete $postBody, $optParams = array())
177  {
178    $params = array('userKey' => $userKey, 'postBody' => $postBody);
179    $params = array_merge($params, $optParams);
180    return $this->call('undelete', array($params));
181  }
182  /**
183   * Updates a user. This method supports patch semantics, meaning you only need
184   * to include the fields you wish to update. Fields that are not present in the
185   * request will be preserved, and fields set to `null` will be cleared.
186   * (users.update)
187   *
188   * @param string $userKey Identifies the user in the API request. The value can
189   * be the user's primary email address, alias email address, or unique user ID.
190   * @param Google_Service_Directory_User $postBody
191   * @param array $optParams Optional parameters.
192   * @return Google_Service_Directory_User
193   */
194  public function update($userKey, Google_Service_Directory_User $postBody, $optParams = array())
195  {
196    $params = array('userKey' => $userKey, 'postBody' => $postBody);
197    $params = array_merge($params, $optParams);
198    return $this->call('update', array($params), "Google_Service_Directory_User");
199  }
200  /**
201   * Watch for changes in users list (users.watch)
202   *
203   * @param Google_Service_Directory_Channel $postBody
204   * @param array $optParams Optional parameters.
205   *
206   * @opt_param string customFieldMask Comma-separated list of schema names. All
207   * fields from these schemas are fetched. This should only be set when
208   * projection=custom.
209   * @opt_param string customer Immutable ID of the Google Workspace account. In
210   * case of multi-domain, to fetch all users for a customer, fill this field
211   * instead of domain.
212   * @opt_param string domain Name of the domain. Fill this field to get users
213   * from only this domain. To return all users in a multi-domain fill customer
214   * field instead."
215   * @opt_param string event Events to watch for.
216   * @opt_param int maxResults Maximum number of results to return.
217   * @opt_param string orderBy Column to use for sorting results
218   * @opt_param string pageToken Token to specify next page in the list
219   * @opt_param string projection What subset of fields to fetch for this user.
220   * @opt_param string query Query string search. Should be of the form "".
221   * Complete documentation is at https: //developers.google.com/admin-
222   * sdk/directory/v1/guides/search-users
223   * @opt_param string showDeleted If set to true, retrieves the list of deleted
224   * users. (Default: false)
225   * @opt_param string sortOrder Whether to return results in ascending or
226   * descending order.
227   * @opt_param string viewType Whether to fetch the administrator-only or domain-
228   * wide public view of the user. For more information, see [Retrieve a user as a
229   * non-administrator](/admin-sdk/directory/v1/guides/manage-
230   * users#retrieve_users_non_admin).
231   * @return Google_Service_Directory_Channel
232   */
233  public function watch(Google_Service_Directory_Channel $postBody, $optParams = array())
234  {
235    $params = array('postBody' => $postBody);
236    $params = array_merge($params, $optParams);
237    return $this->call('watch', array($params), "Google_Service_Directory_Channel");
238  }
239}
240