@@ -164,6 +164,27 @@ def bulk_add(self, users: Iterable[UserItem]) -> JobItem:
164
164
-------
165
165
JobItem
166
166
The job that is started for adding the users in bulk.
167
+
168
+ Examples
169
+ --------
170
+ >>> import tableauserverclient as TSC
171
+ >>> server = TSC.Server('http://localhost')
172
+ >>> # Login to the server
173
+
174
+ >>> # Create a list of UserItem objects to add to the site
175
+ >>> users = [
176
+ >>> TSC.UserItem(name="user1", site_role="Unlicensed"),
177
+ >>> TSC.UserItem(name="user2", site_role="Explorer"),
178
+ >>> TSC.UserItem(name="user3", site_role="Creator"),
179
+ >>> ]
180
+
181
+ >>> # Set the domain name for the users
182
+ >>> for user in users:
183
+ >>> user.domain_name = "example.com"
184
+
185
+ >>> # Add the users to the site
186
+ >>> job = server.users.bulk_add(users)
187
+
167
188
"""
168
189
url = f"{ self .baseurl } /import"
169
190
# Allow for iterators to be passed into the function
@@ -191,6 +212,16 @@ def bulk_remove(self, users: Iterable[UserItem]) -> None:
191
212
Returns
192
213
-------
193
214
None
215
+
216
+ Examples
217
+ --------
218
+ >>> import tableauserverclient as TSC
219
+ >>> server = TSC.Server('http://localhost')
220
+ >>> # Login to the server
221
+
222
+ >>> # Find the users to remove
223
+ >>> example_users = server.users.filter(domain_name="example.com")
224
+ >>> server.users.bulk_remove(example_users)
194
225
"""
195
226
url = f"{ self .baseurl } /delete"
196
227
csv_content = remove_users_csv (users )
0 commit comments