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\OrgUnit;
21use Google\Service\Directory\OrgUnits as OrgUnitsModel;
22
23/**
24 * The "orgunits" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $adminService = new Google\Service\Directory(...);
28 *   $orgunits = $adminService->orgunits;
29 *  </code>
30 */
31class Orgunits extends \Google\Service\Resource
32{
33  /**
34   * Removes an organizational unit. (orgunits.delete)
35   *
36   * @param string $customerId The unique ID for the customer's Google Workspace
37   * account. As an account administrator, you can also use the `my_customer`
38   * alias to represent your account's `customerId`. The `customerId` is also
39   * returned as part of the [Users resource](/admin-
40   * sdk/directory/v1/reference/users).
41   * @param string $orgUnitPath The full path of the organizational unit (minus
42   * the leading `/`) or its unique ID.
43   * @param array $optParams Optional parameters.
44   */
45  public function delete($customerId, $orgUnitPath, $optParams = [])
46  {
47    $params = ['customerId' => $customerId, 'orgUnitPath' => $orgUnitPath];
48    $params = array_merge($params, $optParams);
49    return $this->call('delete', [$params]);
50  }
51  /**
52   * Retrieves an organizational unit. (orgunits.get)
53   *
54   * @param string $customerId The unique ID for the customer's Google Workspace
55   * account. As an account administrator, you can also use the `my_customer`
56   * alias to represent your account's `customerId`. The `customerId` is also
57   * returned as part of the [Users resource](/admin-
58   * sdk/directory/v1/reference/users).
59   * @param string $orgUnitPath The full path of the organizational unit (minus
60   * the leading `/`) or its unique ID.
61   * @param array $optParams Optional parameters.
62   * @return OrgUnit
63   */
64  public function get($customerId, $orgUnitPath, $optParams = [])
65  {
66    $params = ['customerId' => $customerId, 'orgUnitPath' => $orgUnitPath];
67    $params = array_merge($params, $optParams);
68    return $this->call('get', [$params], OrgUnit::class);
69  }
70  /**
71   * Adds an organizational unit. (orgunits.insert)
72   *
73   * @param string $customerId The unique ID for the customer's Google Workspace
74   * account. As an account administrator, you can also use the `my_customer`
75   * alias to represent your account's `customerId`. The `customerId` is also
76   * returned as part of the [Users resource](/admin-
77   * sdk/directory/v1/reference/users).
78   * @param OrgUnit $postBody
79   * @param array $optParams Optional parameters.
80   * @return OrgUnit
81   */
82  public function insert($customerId, OrgUnit $postBody, $optParams = [])
83  {
84    $params = ['customerId' => $customerId, 'postBody' => $postBody];
85    $params = array_merge($params, $optParams);
86    return $this->call('insert', [$params], OrgUnit::class);
87  }
88  /**
89   * Retrieves a list of all organizational units for an account.
90   * (orgunits.listOrgunits)
91   *
92   * @param string $customerId The unique ID for the customer's Google Workspace
93   * account. As an account administrator, you can also use the `my_customer`
94   * alias to represent your account's `customerId`. The `customerId` is also
95   * returned as part of the [Users resource](/admin-
96   * sdk/directory/v1/reference/users).
97   * @param array $optParams Optional parameters.
98   *
99   * @opt_param string orgUnitPath The full path to the organizational unit or its
100   * unique ID. Returns the children of the specified organizational unit.
101   * @opt_param string type Whether to return all sub-organizations or just
102   * immediate children.
103   * @return OrgUnitsModel
104   */
105  public function listOrgunits($customerId, $optParams = [])
106  {
107    $params = ['customerId' => $customerId];
108    $params = array_merge($params, $optParams);
109    return $this->call('list', [$params], OrgUnitsModel::class);
110  }
111  /**
112   * Updates an organizational unit. This method supports [patch semantics
113   * ](/admin-sdk/directory/v1/guides/performance#patch) (orgunits.patch)
114   *
115   * @param string $customerId The unique ID for the customer's Google Workspace
116   * account. As an account administrator, you can also use the `my_customer`
117   * alias to represent your account's `customerId`. The `customerId` is also
118   * returned as part of the [Users resource](/admin-
119   * sdk/directory/v1/reference/users).
120   * @param string $orgUnitPath The full path of the organizational unit (minus
121   * the leading `/`) or its unique ID.
122   * @param OrgUnit $postBody
123   * @param array $optParams Optional parameters.
124   * @return OrgUnit
125   */
126  public function patch($customerId, $orgUnitPath, OrgUnit $postBody, $optParams = [])
127  {
128    $params = ['customerId' => $customerId, 'orgUnitPath' => $orgUnitPath, 'postBody' => $postBody];
129    $params = array_merge($params, $optParams);
130    return $this->call('patch', [$params], OrgUnit::class);
131  }
132  /**
133   * Updates an organizational unit. (orgunits.update)
134   *
135   * @param string $customerId The unique ID for the customer's Google Workspace
136   * account. As an account administrator, you can also use the `my_customer`
137   * alias to represent your account's `customerId`. The `customerId` is also
138   * returned as part of the [Users resource](/admin-
139   * sdk/directory/v1/reference/users).
140   * @param string $orgUnitPath The full path of the organizational unit (minus
141   * the leading `/`) or its unique ID.
142   * @param OrgUnit $postBody
143   * @param array $optParams Optional parameters.
144   * @return OrgUnit
145   */
146  public function update($customerId, $orgUnitPath, OrgUnit $postBody, $optParams = [])
147  {
148    $params = ['customerId' => $customerId, 'orgUnitPath' => $orgUnitPath, 'postBody' => $postBody];
149    $params = array_merge($params, $optParams);
150    return $this->call('update', [$params], OrgUnit::class);
151  }
152}
153
154// Adding a class alias for backwards compatibility with the previous class name.
155class_alias(Orgunits::class, 'Google_Service_Directory_Resource_Orgunits');
156