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 | namespace Google\Service\DisplayVideo\Resource;
|
---|
19 |
|
---|
20 | use Google\Service\DisplayVideo\BulkEditAssignedUserRolesRequest;
|
---|
21 | use Google\Service\DisplayVideo\BulkEditAssignedUserRolesResponse;
|
---|
22 | use Google\Service\DisplayVideo\DisplayvideoEmpty;
|
---|
23 | use Google\Service\DisplayVideo\ListUsersResponse;
|
---|
24 | use 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 | */
|
---|
34 | class 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. This method has
|
---|
41 | * unique authentication requirements. Read the prerequisites in our [Managing
|
---|
42 | * Users guide](/display-video/api/guides/users/overview#prerequisites) before
|
---|
43 | * using this method. The "Try this method" feature does not work for this
|
---|
44 | * method. (users.bulkEditAssignedUserRoles)
|
---|
45 | *
|
---|
46 | * @param string $userId Required. The ID of the user to which the assigned user
|
---|
47 | * roles belong.
|
---|
48 | * @param BulkEditAssignedUserRolesRequest $postBody
|
---|
49 | * @param array $optParams Optional parameters.
|
---|
50 | * @return BulkEditAssignedUserRolesResponse
|
---|
51 | * @throws \Google\Service\Exception
|
---|
52 | */
|
---|
53 | public function bulkEditAssignedUserRoles($userId, BulkEditAssignedUserRolesRequest $postBody, $optParams = [])
|
---|
54 | {
|
---|
55 | $params = ['userId' => $userId, 'postBody' => $postBody];
|
---|
56 | $params = array_merge($params, $optParams);
|
---|
57 | return $this->call('bulkEditAssignedUserRoles', [$params], BulkEditAssignedUserRolesResponse::class);
|
---|
58 | }
|
---|
59 | /**
|
---|
60 | * Creates a new user. Returns the newly created user if successful. This method
|
---|
61 | * has unique authentication requirements. Read the prerequisites in our
|
---|
62 | * [Managing Users guide](/display-
|
---|
63 | * video/api/guides/users/overview#prerequisites) before using this method. The
|
---|
64 | * "Try this method" feature does not work for this method. (users.create)
|
---|
65 | *
|
---|
66 | * @param User $postBody
|
---|
67 | * @param array $optParams Optional parameters.
|
---|
68 | * @return User
|
---|
69 | * @throws \Google\Service\Exception
|
---|
70 | */
|
---|
71 | public function create(User $postBody, $optParams = [])
|
---|
72 | {
|
---|
73 | $params = ['postBody' => $postBody];
|
---|
74 | $params = array_merge($params, $optParams);
|
---|
75 | return $this->call('create', [$params], User::class);
|
---|
76 | }
|
---|
77 | /**
|
---|
78 | * Deletes a user. This method has unique authentication requirements. Read the
|
---|
79 | * prerequisites in our [Managing Users guide](/display-
|
---|
80 | * video/api/guides/users/overview#prerequisites) before using this method. The
|
---|
81 | * "Try this method" feature does not work for this method. (users.delete)
|
---|
82 | *
|
---|
83 | * @param string $userId Required. The ID of the user to delete.
|
---|
84 | * @param array $optParams Optional parameters.
|
---|
85 | * @return DisplayvideoEmpty
|
---|
86 | * @throws \Google\Service\Exception
|
---|
87 | */
|
---|
88 | public function delete($userId, $optParams = [])
|
---|
89 | {
|
---|
90 | $params = ['userId' => $userId];
|
---|
91 | $params = array_merge($params, $optParams);
|
---|
92 | return $this->call('delete', [$params], DisplayvideoEmpty::class);
|
---|
93 | }
|
---|
94 | /**
|
---|
95 | * Gets a user. This method has unique authentication requirements. Read the
|
---|
96 | * prerequisites in our [Managing Users guide](/display-
|
---|
97 | * video/api/guides/users/overview#prerequisites) before using this method. The
|
---|
98 | * "Try this method" feature does not work for this method. (users.get)
|
---|
99 | *
|
---|
100 | * @param string $userId Required. The ID of the user to fetch.
|
---|
101 | * @param array $optParams Optional parameters.
|
---|
102 | * @return User
|
---|
103 | * @throws \Google\Service\Exception
|
---|
104 | */
|
---|
105 | public function get($userId, $optParams = [])
|
---|
106 | {
|
---|
107 | $params = ['userId' => $userId];
|
---|
108 | $params = array_merge($params, $optParams);
|
---|
109 | return $this->call('get', [$params], User::class);
|
---|
110 | }
|
---|
111 | /**
|
---|
112 | * Lists users that are accessible to the current user. If two users have user
|
---|
113 | * roles on the same partner or advertiser, they can access each other. This
|
---|
114 | * method has unique authentication requirements. Read the prerequisites in our
|
---|
115 | * [Managing Users guide](/display-
|
---|
116 | * video/api/guides/users/overview#prerequisites) before using this method. The
|
---|
117 | * "Try this method" feature does not work for this method. (users.listUsers)
|
---|
118 | *
|
---|
119 | * @param array $optParams Optional parameters.
|
---|
120 | *
|
---|
121 | * @opt_param string filter Allows filtering by user fields. Supported syntax: *
|
---|
122 | * Filter expressions are made up of one or more restrictions. * Restrictions
|
---|
123 | * can be combined by the logical operator `AND`. * A restriction has the form
|
---|
124 | * of `{field} {operator} {value}`. * The `displayName` and `email` fields must
|
---|
125 | * use the `HAS (:)` operator. * The `lastLoginTime` field must use either the
|
---|
126 | * `LESS THAN OR EQUAL TO (<=)` or `GREATER THAN OR EQUAL TO (>=)` operator. *
|
---|
127 | * All other fields must use the `EQUALS (=)` operator. Supported fields: *
|
---|
128 | * `assignedUserRole.advertiserId` * `assignedUserRole.entityType`: This is
|
---|
129 | * synthetic field of `AssignedUserRole` used for filtering. Identifies the type
|
---|
130 | * of entity to which the user role is assigned. Valid values are `Partner` and
|
---|
131 | * `Advertiser`. * `assignedUserRole.parentPartnerId`: This is a synthetic field
|
---|
132 | * of `AssignedUserRole` used for filtering. Identifies the parent partner of
|
---|
133 | * the entity to which the user role is assigned. * `assignedUserRole.partnerId`
|
---|
134 | * * `assignedUserRole.userRole` * `displayName` * `email` * `lastLoginTime`
|
---|
135 | * (input in ISO 8601 format, or `YYYY-MM-DDTHH:MM:SSZ`) Examples: * The user
|
---|
136 | * with `displayName` containing "foo": `displayName:"foo"` * The user with
|
---|
137 | * `email` containing "bar": `email:"bar"` * All users with standard user roles:
|
---|
138 | * `assignedUserRole.userRole="STANDARD"` * All users with user roles for
|
---|
139 | * partner 123: `assignedUserRole.partnerId="123"` * All users with user roles
|
---|
140 | * for advertiser 123: `assignedUserRole.advertiserId="123"` * All users with
|
---|
141 | * partner level user roles: `entityType="PARTNER"` * All users with user roles
|
---|
142 | * for partner 123 and advertisers under partner 123: `parentPartnerId="123"` *
|
---|
143 | * All users that last logged in on or after 2023-01-01T00:00:00Z (format of ISO
|
---|
144 | * 8601): `lastLoginTime>="2023-01-01T00:00:00Z"` The length of this field
|
---|
145 | * should be no more than 500 characters. Reference our [filter `LIST`
|
---|
146 | * requests](/display-video/api/guides/how-tos/filters) guide for more
|
---|
147 | * information.
|
---|
148 | * @opt_param string orderBy Field by which to sort the list. Acceptable values
|
---|
149 | * are: * `displayName` (default) The default sorting order is ascending. To
|
---|
150 | * specify descending order for a field, a suffix "desc" should be added to the
|
---|
151 | * field name. For example, `displayName desc`.
|
---|
152 | * @opt_param int pageSize Requested page size. Must be between `1` and `200`.
|
---|
153 | * If unspecified will default to `100`.
|
---|
154 | * @opt_param string pageToken A token identifying a page of results the server
|
---|
155 | * should return. Typically, this is the value of next_page_token returned from
|
---|
156 | * the previous call to `ListUsers` method. If not specified, the first page of
|
---|
157 | * results will be returned.
|
---|
158 | * @return ListUsersResponse
|
---|
159 | * @throws \Google\Service\Exception
|
---|
160 | */
|
---|
161 | public function listUsers($optParams = [])
|
---|
162 | {
|
---|
163 | $params = [];
|
---|
164 | $params = array_merge($params, $optParams);
|
---|
165 | return $this->call('list', [$params], ListUsersResponse::class);
|
---|
166 | }
|
---|
167 | /**
|
---|
168 | * Updates an existing user. Returns the updated user if successful. This method
|
---|
169 | * has unique authentication requirements. Read the prerequisites in our
|
---|
170 | * [Managing Users guide](/display-
|
---|
171 | * video/api/guides/users/overview#prerequisites) before using this method. The
|
---|
172 | * "Try this method" feature does not work for this method. (users.patch)
|
---|
173 | *
|
---|
174 | * @param string $userId Output only. The unique ID of the user. Assigned by the
|
---|
175 | * system.
|
---|
176 | * @param User $postBody
|
---|
177 | * @param array $optParams Optional parameters.
|
---|
178 | *
|
---|
179 | * @opt_param string updateMask Required. The mask to control which fields to
|
---|
180 | * update.
|
---|
181 | * @return User
|
---|
182 | * @throws \Google\Service\Exception
|
---|
183 | */
|
---|
184 | public function patch($userId, User $postBody, $optParams = [])
|
---|
185 | {
|
---|
186 | $params = ['userId' => $userId, 'postBody' => $postBody];
|
---|
187 | $params = array_merge($params, $optParams);
|
---|
188 | return $this->call('patch', [$params], User::class);
|
---|
189 | }
|
---|
190 | }
|
---|
191 |
|
---|
192 | // Adding a class alias for backwards compatibility with the previous class name.
|
---|
193 | class_alias(Users::class, 'Google_Service_DisplayVideo_Resource_Users');
|
---|