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\Dfareporting\Resource;
19
20use Google\Service\Dfareporting\UserRole;
21use Google\Service\Dfareporting\UserRolesListResponse;
22
23/**
24 * The "userRoles" collection of methods.
25 * Typical usage is:
26 *  <code>
27 *   $dfareportingService = new Google\Service\Dfareporting(...);
28 *   $userRoles = $dfareportingService->userRoles;
29 *  </code>
30 */
31class UserRoles extends \Google\Service\Resource
32{
33  /**
34   * Deletes an existing user role. (userRoles.delete)
35   *
36   * @param string $profileId User profile ID associated with this request.
37   * @param string $id User role ID.
38   * @param array $optParams Optional parameters.
39   */
40  public function delete($profileId, $id, $optParams = [])
41  {
42    $params = ['profileId' => $profileId, 'id' => $id];
43    $params = array_merge($params, $optParams);
44    return $this->call('delete', [$params]);
45  }
46  /**
47   * Gets one user role by ID. (userRoles.get)
48   *
49   * @param string $profileId User profile ID associated with this request.
50   * @param string $id User role ID.
51   * @param array $optParams Optional parameters.
52   * @return UserRole
53   */
54  public function get($profileId, $id, $optParams = [])
55  {
56    $params = ['profileId' => $profileId, 'id' => $id];
57    $params = array_merge($params, $optParams);
58    return $this->call('get', [$params], UserRole::class);
59  }
60  /**
61   * Inserts a new user role. (userRoles.insert)
62   *
63   * @param string $profileId User profile ID associated with this request.
64   * @param UserRole $postBody
65   * @param array $optParams Optional parameters.
66   * @return UserRole
67   */
68  public function insert($profileId, UserRole $postBody, $optParams = [])
69  {
70    $params = ['profileId' => $profileId, 'postBody' => $postBody];
71    $params = array_merge($params, $optParams);
72    return $this->call('insert', [$params], UserRole::class);
73  }
74  /**
75   * Retrieves a list of user roles, possibly filtered. This method supports
76   * paging. (userRoles.listUserRoles)
77   *
78   * @param string $profileId User profile ID associated with this request.
79   * @param array $optParams Optional parameters.
80   *
81   * @opt_param bool accountUserRoleOnly Select only account level user roles not
82   * associated with any specific subaccount.
83   * @opt_param string ids Select only user roles with the specified IDs.
84   * @opt_param int maxResults Maximum number of results to return.
85   * @opt_param string pageToken Value of the nextPageToken from the previous
86   * result page.
87   * @opt_param string searchString Allows searching for objects by name or ID.
88   * Wildcards (*) are allowed. For example, "userrole*2015" will return objects
89   * with names like "userrole June 2015", "userrole April 2015", or simply
90   * "userrole 2015". Most of the searches also add wildcards implicitly at the
91   * start and the end of the search string. For example, a search string of
92   * "userrole" will match objects with name "my userrole", "userrole 2015", or
93   * simply "userrole".
94   * @opt_param string sortField Field by which to sort the list.
95   * @opt_param string sortOrder Order of sorted results.
96   * @opt_param string subaccountId Select only user roles that belong to this
97   * subaccount.
98   * @return UserRolesListResponse
99   */
100  public function listUserRoles($profileId, $optParams = [])
101  {
102    $params = ['profileId' => $profileId];
103    $params = array_merge($params, $optParams);
104    return $this->call('list', [$params], UserRolesListResponse::class);
105  }
106  /**
107   * Updates an existing user role. This method supports patch semantics.
108   * (userRoles.patch)
109   *
110   * @param string $profileId User profile ID associated with this request.
111   * @param string $id UserRole ID.
112   * @param UserRole $postBody
113   * @param array $optParams Optional parameters.
114   * @return UserRole
115   */
116  public function patch($profileId, $id, UserRole $postBody, $optParams = [])
117  {
118    $params = ['profileId' => $profileId, 'id' => $id, 'postBody' => $postBody];
119    $params = array_merge($params, $optParams);
120    return $this->call('patch', [$params], UserRole::class);
121  }
122  /**
123   * Updates an existing user role. (userRoles.update)
124   *
125   * @param string $profileId User profile ID associated with this request.
126   * @param UserRole $postBody
127   * @param array $optParams Optional parameters.
128   * @return UserRole
129   */
130  public function update($profileId, UserRole $postBody, $optParams = [])
131  {
132    $params = ['profileId' => $profileId, 'postBody' => $postBody];
133    $params = array_merge($params, $optParams);
134    return $this->call('update', [$params], UserRole::class);
135  }
136}
137
138// Adding a class alias for backwards compatibility with the previous class name.
139class_alias(UserRoles::class, 'Google_Service_Dfareporting_Resource_UserRoles');
140