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\Directory\Resource;
19
20use Google\Service\Directory\Role;
21use Google\Service\Directory\Roles as RolesModel;
22
23/**
24 * The "roles" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $adminService = new Google\Service\Directory(...);
28 *   $roles = $adminService->roles;
29 *  </code>
30 */
31class Roles extends \Google\Service\Resource
32{
33  /**
34   * Deletes a role. (roles.delete)
35   *
36   * @param string $customer Immutable ID of the Google Workspace account.
37   * @param string $roleId Immutable ID of the role.
38   * @param array $optParams Optional parameters.
39   */
40  public function delete($customer, $roleId, $optParams = [])
41  {
42    $params = ['customer' => $customer, 'roleId' => $roleId];
43    $params = array_merge($params, $optParams);
44    return $this->call('delete', [$params]);
45  }
46  /**
47   * Retrieves a role. (roles.get)
48   *
49   * @param string $customer Immutable ID of the Google Workspace account.
50   * @param string $roleId Immutable ID of the role.
51   * @param array $optParams Optional parameters.
52   * @return Role
53   */
54  public function get($customer, $roleId, $optParams = [])
55  {
56    $params = ['customer' => $customer, 'roleId' => $roleId];
57    $params = array_merge($params, $optParams);
58    return $this->call('get', [$params], Role::class);
59  }
60  /**
61   * Creates a role. (roles.insert)
62   *
63   * @param string $customer Immutable ID of the Google Workspace account.
64   * @param Role $postBody
65   * @param array $optParams Optional parameters.
66   * @return Role
67   */
68  public function insert($customer, Role $postBody, $optParams = [])
69  {
70    $params = ['customer' => $customer, 'postBody' => $postBody];
71    $params = array_merge($params, $optParams);
72    return $this->call('insert', [$params], Role::class);
73  }
74  /**
75   * Retrieves a paginated list of all the roles in a domain. (roles.listRoles)
76   *
77   * @param string $customer Immutable ID of the Google Workspace account.
78   * @param array $optParams Optional parameters.
79   *
80   * @opt_param int maxResults Maximum number of results to return.
81   * @opt_param string pageToken Token to specify the next page in the list.
82   * @return RolesModel
83   */
84  public function listRoles($customer, $optParams = [])
85  {
86    $params = ['customer' => $customer];
87    $params = array_merge($params, $optParams);
88    return $this->call('list', [$params], RolesModel::class);
89  }
90  /**
91   * Patches a role. (roles.patch)
92   *
93   * @param string $customer Immutable ID of the Google Workspace account.
94   * @param string $roleId Immutable ID of the role.
95   * @param Role $postBody
96   * @param array $optParams Optional parameters.
97   * @return Role
98   */
99  public function patch($customer, $roleId, Role $postBody, $optParams = [])
100  {
101    $params = ['customer' => $customer, 'roleId' => $roleId, 'postBody' => $postBody];
102    $params = array_merge($params, $optParams);
103    return $this->call('patch', [$params], Role::class);
104  }
105  /**
106   * Updates a role. (roles.update)
107   *
108   * @param string $customer Immutable ID of the Google Workspace account.
109   * @param string $roleId Immutable ID of the role.
110   * @param Role $postBody
111   * @param array $optParams Optional parameters.
112   * @return Role
113   */
114  public function update($customer, $roleId, Role $postBody, $optParams = [])
115  {
116    $params = ['customer' => $customer, 'roleId' => $roleId, 'postBody' => $postBody];
117    $params = array_merge($params, $optParams);
118    return $this->call('update', [$params], Role::class);
119  }
120}
121
122// Adding a class alias for backwards compatibility with the previous class name.
123class_alias(Roles::class, 'Google_Service_Directory_Resource_Roles');
124