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\DisplayVideo\Resource;
19
20use Google\Service\DisplayVideo\BulkEditAssignedUserRolesRequest;
21use Google\Service\DisplayVideo\BulkEditAssignedUserRolesResponse;
22use Google\Service\DisplayVideo\DisplayvideoEmpty;
23use Google\Service\DisplayVideo\ListUsersResponse;
24use Google\Service\DisplayVideo\User;
25
26/**
27 * The "users" collection of methods.
28 * Typical usage is:
29 *  <code>
30 *   $displayvideoService = new Google\Service\DisplayVideo(...);
31 *   $users = $displayvideoService->users;
32 *  </code>
33 */
34class Users extends \Google\Service\Resource
35{
36  /**
37   * Bulk edits user roles for a user. The operation will delete the assigned user
38   * roles provided in BulkEditAssignedUserRolesRequest.deletedAssignedUserRoles
39   * and then assign the user roles provided in
40   * BulkEditAssignedUserRolesRequest.createdAssignedUserRoles.
41   * (users.bulkEditAssignedUserRoles)
42   *
43   * @param string $userId Required. The ID of the user to which the assigned user
44   * roles belong.
45   * @param BulkEditAssignedUserRolesRequest $postBody
46   * @param array $optParams Optional parameters.
47   * @return BulkEditAssignedUserRolesResponse
48   */
49  public function bulkEditAssignedUserRoles($userId, BulkEditAssignedUserRolesRequest $postBody, $optParams = [])
50  {
51    $params = ['userId' => $userId, 'postBody' => $postBody];
52    $params = array_merge($params, $optParams);
53    return $this->call('bulkEditAssignedUserRoles', [$params], BulkEditAssignedUserRolesResponse::class);
54  }
55  /**
56   * Creates a new user. Returns the newly created user if successful.
57   * (users.create)
58   *
59   * @param User $postBody
60   * @param array $optParams Optional parameters.
61   * @return User
62   */
63  public function create(User $postBody, $optParams = [])
64  {
65    $params = ['postBody' => $postBody];
66    $params = array_merge($params, $optParams);
67    return $this->call('create', [$params], User::class);
68  }
69  /**
70   * Deletes a user. (users.delete)
71   *
72   * @param string $userId Required. The ID of the user to delete.
73   * @param array $optParams Optional parameters.
74   * @return DisplayvideoEmpty
75   */
76  public function delete($userId, $optParams = [])
77  {
78    $params = ['userId' => $userId];
79    $params = array_merge($params, $optParams);
80    return $this->call('delete', [$params], DisplayvideoEmpty::class);
81  }
82  /**
83   * Gets a user. (users.get)
84   *
85   * @param string $userId Required. The ID of the user to fetch.
86   * @param array $optParams Optional parameters.
87   * @return User
88   */
89  public function get($userId, $optParams = [])
90  {
91    $params = ['userId' => $userId];
92    $params = array_merge($params, $optParams);
93    return $this->call('get', [$params], User::class);
94  }
95  /**
96   * Lists users that are accessible to the current user. If two users have user
97   * roles on the same partner or advertiser, they can access each other.
98   * (users.listUsers)
99   *
100   * @param array $optParams Optional parameters.
101   *
102   * @opt_param string filter Allows filtering by user properties. Supported
103   * syntax: * Filter expressions are made up of one or more restrictions. *
104   * Restrictions can be combined by the logical operator `AND`. * A restriction
105   * has the form of `{field} {operator} {value}`. * The operator must be
106   * `CONTAINS (:)` or `EQUALS (=)`. * The operator must be `CONTAINS (:)` for the
107   * following fields: - `displayName` - `email` * The operator must be `EQUALS
108   * (=)` for the following fields: - `assignedUserRole.userRole` -
109   * `assignedUserRole.partnerId` - `assignedUserRole.advertiserId` -
110   * `assignedUserRole.entityType`: A synthetic field of AssignedUserRole used for
111   * filtering. Identifies the type of entity to which the user role is assigned.
112   * Valid values are `Partner` and `Advertiser`. -
113   * `assignedUserRole.parentPartnerId`: A synthetic field of AssignedUserRole
114   * used for filtering. Identifies the parent partner of the entity to which the
115   * user role is assigned." Examples: * The user with displayName containing
116   * `foo`: `displayName:"foo"` * The user with email containing `bar`:
117   * `email:"bar"` * All users with standard user roles:
118   * `assignedUserRole.userRole="STANDARD"` * All users with user roles for
119   * partner 123: `assignedUserRole.partnerId="123"` * All users with user roles
120   * for advertiser 123: `assignedUserRole.advertiserId="123"` * All users with
121   * partner level user roles: `entityType="PARTNER"` * All users with user roles
122   * for partner 123 and advertisers under partner 123: `parentPartnerId="123"`
123   * The length of this field should be no more than 500 characters.
124   * @opt_param string orderBy Field by which to sort the list. Acceptable values
125   * are: * `displayName` (default) The default sorting order is ascending. To
126   * specify descending order for a field, a suffix "desc" should be added to the
127   * field name. For example, `displayName desc`.
128   * @opt_param int pageSize Requested page size. Must be between `1` and `100`.
129   * If unspecified will default to `100`.
130   * @opt_param string pageToken A token identifying a page of results the server
131   * should return. Typically, this is the value of next_page_token returned from
132   * the previous call to `ListUsers` method. If not specified, the first page of
133   * results will be returned.
134   * @return ListUsersResponse
135   */
136  public function listUsers($optParams = [])
137  {
138    $params = [];
139    $params = array_merge($params, $optParams);
140    return $this->call('list', [$params], ListUsersResponse::class);
141  }
142  /**
143   * Updates an existing user. Returns the updated user if successful.
144   * (users.patch)
145   *
146   * @param string $userId Output only. The unique ID of the user. Assigned by the
147   * system.
148   * @param User $postBody
149   * @param array $optParams Optional parameters.
150   *
151   * @opt_param string updateMask Required. The mask to control which fields to
152   * update.
153   * @return User
154   */
155  public function patch($userId, User $postBody, $optParams = [])
156  {
157    $params = ['userId' => $userId, 'postBody' => $postBody];
158    $params = array_merge($params, $optParams);
159    return $this->call('patch', [$params], User::class);
160  }
161}
162
163// Adding a class alias for backwards compatibility with the previous class name.
164class_alias(Users::class, 'Google_Service_DisplayVideo_Resource_Users');
165