1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
use anyhow::Result;
use crate::Client;
pub struct Users {
pub client: Client,
}
impl Users {
#[doc(hidden)]
pub fn new(client: Client) -> Self {
Users { client }
}
/**
* Retrieves the list of users for the specified account.
*
* This function performs a `GET` to the `/v2.1/accounts/{accountId}/users` endpoint.
*
* Retrieves the list of users for the specified account.
*
* The response returns the list of users for the account, with information about the result set. If the `additional_info` query is added to the endpoint and set to **true**, full user information is returned for each user.
*
* **Parameters:**
*
* * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `additional_info: &str` -- When set to **true**, the custom settings information is returned for each user in the account. If this parameter is omitted, the default behavior is **false**.
* * `count: &str` -- The number of records to return. This number must be greater than `0` and less than or equal to `100`. .
* * `email: &str` -- Filters results based on the email address associated with the user that you want to return.
*
* **Note**: You can use either this parameter or the `email_substring` parameter, but not both. For older accounts, this parameter might return multiple users who are associated with a single email address.
* * `email_substring: &str` -- Filters results based on a fragment of an email address. For example, you could enter `gmail` to return all users who have Gmail addresses.
*
* **Note**: You do not use a wildcard character with this parameter. You can use either this parameter or the `email` parameter, but not both.
* * `group_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `include_usersettings_for_csv: &str` -- When set to **true**, the response includes the `userSettings` object data in CSV format.
* * `login_status: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `not_group_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `start_position: &str` -- The position within the total result set from which to start returning values.
* * `status: &str` -- Filters results by user account status. Possible values are:
*
* * `ActivationRequired`
* * `ActivationSent`
* * `Active`
* * `Closed`
* * `Disabled`
* .
* * `user_name_substring: &str` -- Filters results based on a full or partial user name.
*
* **Note**: When you enter a partial user name, you do not use a wildcard character.
*/
pub async fn get(
&self,
account_id: &str,
additional_info: &str,
count: &str,
email: &str,
email_substring: &str,
group_id: &str,
include_usersettings_for_csv: &str,
login_status: &str,
not_group_id: &str,
start_position: &str,
status: &str,
user_name_substring: &str,
) -> Result<crate::types::UserInformationList> {
let mut query_args: Vec<(String, String)> = Default::default();
if !additional_info.is_empty() {
query_args.push(("additional_info".to_string(), additional_info.to_string()));
}
if !count.is_empty() {
query_args.push(("count".to_string(), count.to_string()));
}
if !email.is_empty() {
query_args.push(("email".to_string(), email.to_string()));
}
if !email_substring.is_empty() {
query_args.push(("email_substring".to_string(), email_substring.to_string()));
}
if !group_id.is_empty() {
query_args.push(("group_id".to_string(), group_id.to_string()));
}
if !include_usersettings_for_csv.is_empty() {
query_args.push((
"include_usersettings_for_csv".to_string(),
include_usersettings_for_csv.to_string(),
));
}
if !login_status.is_empty() {
query_args.push(("login_status".to_string(), login_status.to_string()));
}
if !not_group_id.is_empty() {
query_args.push(("not_group_id".to_string(), not_group_id.to_string()));
}
if !start_position.is_empty() {
query_args.push(("start_position".to_string(), start_position.to_string()));
}
if !status.is_empty() {
query_args.push(("status".to_string(), status.to_string()));
}
if !user_name_substring.is_empty() {
query_args.push((
"user_name_substring".to_string(),
user_name_substring.to_string(),
));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = format!(
"/v2.1/accounts/{}/users?{}",
crate::progenitor_support::encode_path(account_id),
query_
);
self.client.get(&url, None).await
}
/**
* Changes one or more users in the specified account.
*
* This function performs a `PUT` to the `/v2.1/accounts/{accountId}/users` endpoint.
*
* This method updates the information about one or more account users.
*
* **Parameters:**
*
* * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
*/
pub async fn put(
&self,
account_id: &str,
body: &crate::types::UserInformationList,
) -> Result<crate::types::UserInformationList> {
let url = format!(
"/v2.1/accounts/{}/users",
crate::progenitor_support::encode_path(account_id),
);
self.client
.put(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Adds new users to the specified account.
*
* This function performs a `POST` to the `/v2.1/accounts/{accountId}/users` endpoint.
*
* Adds new users to an account.
*
* The body of this request is an array of `newUsers` objects. For each new user, you must provide at least the `userName` and `email` properties.
*
* The `userSettings` property specifies the actions users can perform. In the example below, Tal Mason will be able to send envelopes, and the activation email will be in French because the `locale` is set to `fr`.
*
*
* ```
* POST /restapi/v2.1/accounts/{accountId}/users
* Content-Type: application/json
* ```
* ```
* {
* "newUsers": [
* {
* "userName": "Claire Horace",
* "email": "claire@example.com"
* },
* {
* "userName": "Tal Mason",
* "email": "talmason@example.com",
* "company": "TeleSel",
* "userSettings": {
* "locale": "fr",
* "canSendEnvelope": true
* }
* }
* ]
* }
* ```
*
* A successful response is a `newUsers` array with information about the newly created users. If there was a problem in creating a user, that user entry will contain an `errorDetails` property that describes what went wrong.
*
* ```json
* {
* "newUsers": [
* {
* "userId": "18f3be12-xxxx-xxxx-xxxx-883d8f9b8ade",
* "uri": "/users/18f3be12-xxxx-xxxx-xxxx-883d8f9b8ade",
* "email": "claire@example.com",
* "userName": "Claire Horace",
* "createdDateTime": "0001-01-01T08:00:00.0000000Z",
* "errorDetails": {
* "errorCode": "USER_ALREADY_EXISTS_IN_ACCOUNT",
* "message": "Username and email combination already exists for this account."
* }
* },
* {
* "userId": "be9899a3-xxxx-xxxx-xxxx-2c8dd7156e33",
* "uri": "/users/be9899a3-xxxx-xxxx-xxxx-2c8dd7156e33",
* "email": "talmason@example.com",
* "userName": "Tal Mason",
* "userStatus": "ActivationSent",
* "createdDateTime": "2020-05-26T23:25:30.7330000Z"
* }
* ]
* }
* ```
*
*
* **Parameters:**
*
* * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
*/
pub async fn post(
&self,
account_id: &str,
body: &crate::types::NewUsersDefinition,
) -> Result<crate::types::NewUsersSummary> {
let url = format!(
"/v2.1/accounts/{}/users",
crate::progenitor_support::encode_path(account_id),
);
self.client
.post(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Removes users account privileges.
*
* This function performs a `DELETE` to the `/v2.1/accounts/{accountId}/users` endpoint.
*
* Closes one or more user records in the account. Users are never deleted from an account, but closing a user prevents them from using account functions.
*
* The response specifies whether the API execution succeeded (200 - OK) or failed (400 - Error). The response contains a user structure similar to the request and includes the user changes. If an error occurred during the DELETE operation for any of the users, the response for that user contains an `errorDetails` property with `errorCode` and `message` properties.
*
* **Parameters:**
*
* * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `delete: &str` -- ID of the user to delete. This parameter takes a comma-separated list of values in the format: `Groups,PermissionSet,SigningGroupsEmail`.
*/
pub async fn delete(
&self,
account_id: &str,
delete: &str,
body: &crate::types::UserInfoList,
) -> Result<crate::types::UsersResponse> {
let mut query_args: Vec<(String, String)> = Default::default();
if !delete.is_empty() {
query_args.push(("delete".to_string(), delete.to_string()));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = format!(
"/v2.1/accounts/{}/users?{}",
crate::progenitor_support::encode_path(account_id),
query_
);
self.client
.delete(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Gets the user information for a specified user.
*
* This function performs a `GET` to the `/v2.1/accounts/{accountId}/users/{userId}` endpoint.
*
* Retrieves the user information for the specified user.
*
* To return additional user information that details the last login date, login status, and the user's password expiration date, set the optional `additional_info` query string parameter to **true**.
*
* **Parameters:**
*
* * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `user_id: &str` -- The ID of the user to access. Generally this is the ID of the current authenticated user, but if the authenticated user is an Administrator on the account, `userId` can represent another user whom the Administrator is accessing.
* .
* * `additional_info: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `email: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
*/
pub async fn get_users(
&self,
account_id: &str,
user_id: &str,
additional_info: &str,
email: &str,
) -> Result<crate::types::UserInformation> {
let mut query_args: Vec<(String, String)> = Default::default();
if !additional_info.is_empty() {
query_args.push(("additional_info".to_string(), additional_info.to_string()));
}
if !email.is_empty() {
query_args.push(("email".to_string(), email.to_string()));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = format!(
"/v2.1/accounts/{}/users/{}?{}",
crate::progenitor_support::encode_path(account_id),
crate::progenitor_support::encode_path(user_id),
query_
);
self.client.get(&url, None).await
}
/**
* Updates user information for the specified user.
*
* This function performs a `PUT` to the `/v2.1/accounts/{accountId}/users/{userId}` endpoint.
*
* To update user information for a specific user, submit a [Users](#Users) object with updated field values in the request body of this operation.
*
* **Parameters:**
*
* * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `user_id: &str` -- The ID of the user to access. Generally this is the ID of the current authenticated user, but if the authenticated user is an Administrator on the account, `userId` can represent another user whom the Administrator is accessing.
* .
*/
pub async fn put_users(
&self,
account_id: &str,
user_id: &str,
body: &crate::types::UserInformation,
) -> Result<crate::types::UserInformation> {
let url = format!(
"/v2.1/accounts/{}/users/{}",
crate::progenitor_support::encode_path(account_id),
crate::progenitor_support::encode_path(user_id),
);
self.client
.put(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
/**
* Retrieves the user profile image for the specified user.
*
* This function performs a `GET` to the `/v2.1/accounts/{accountId}/users/{userId}/profile/image` endpoint.
*
* Retrieves the user profile picture for the specified user. The image is returned in the same format as uploaded.
*
* The userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the specified account.
*
* If successful, the response returns a 200 - OK and the user profile image.
*
* **Parameters:**
*
* * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `user_id: &str` -- The ID of the user to access. Generally this is the ID of the current authenticated user, but if the authenticated user is an Administrator on the account, `userId` can represent another user whom the Administrator is accessing.
* .
* * `encoding: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
*/
pub async fn profile_image_get(
&self,
account_id: &str,
user_id: &str,
encoding: &str,
) -> Result<()> {
let mut query_args: Vec<(String, String)> = Default::default();
if !encoding.is_empty() {
query_args.push(("encoding".to_string(), encoding.to_string()));
}
let query_ = serde_urlencoded::to_string(&query_args).unwrap();
let url = format!(
"/v2.1/accounts/{}/users/{}/profile/image?{}",
crate::progenitor_support::encode_path(account_id),
crate::progenitor_support::encode_path(user_id),
query_
);
self.client.get(&url, None).await
}
/**
* Updates the user profile image for a specified user.
*
* This function performs a `PUT` to the `/v2.1/accounts/{accountId}/users/{userId}/profile/image` endpoint.
*
* Updates the user profile image by uploading an image to the user profile.
*
* The supported image formats are: gif, png, jpeg, and bmp. The file must be less than 200K. For best viewing results, DocuSign recommends that the image is no more than 79 pixels wide and high.
*
* **Parameters:**
*
* * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `user_id: &str` -- The ID of the user to access. Generally this is the ID of the current authenticated user, but if the authenticated user is an Administrator on the account, `userId` can represent another user whom the Administrator is accessing.
* .
*/
pub async fn profile_image_put(&self, account_id: &str, user_id: &str) -> Result<()> {
let url = format!(
"/v2.1/accounts/{}/users/{}/profile/image",
crate::progenitor_support::encode_path(account_id),
crate::progenitor_support::encode_path(user_id),
);
self.client.put(&url, None).await
}
/**
* Deletes the user profile image for the specified user.
*
* This function performs a `DELETE` to the `/v2.1/accounts/{accountId}/users/{userId}/profile/image` endpoint.
*
* Deletes the user profile image from the specified user's profile.
*
* The userId parameter specified in the endpoint must match the authenticated user's user ID and the user must be a member of the specified account.
*
* **Parameters:**
*
* * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `user_id: &str` -- The ID of the user to access. Generally this is the ID of the current authenticated user, but if the authenticated user is an Administrator on the account, `userId` can represent another user whom the Administrator is accessing.
* .
*/
pub async fn profile_image_delete(&self, account_id: &str, user_id: &str) -> Result<()> {
let url = format!(
"/v2.1/accounts/{}/users/{}/profile/image",
crate::progenitor_support::encode_path(account_id),
crate::progenitor_support::encode_path(user_id),
);
self.client.delete(&url, None).await
}
/**
* Gets the user account settings for a specified user.
*
* This function performs a `GET` to the `/v2.1/accounts/{accountId}/users/{userId}/settings` endpoint.
*
* Retrieves a list of the account settings and email
* notification information for the specified user.
*
* The response returns the account setting
* name/value information and the email notification
* settings for the specified user. For more
* information, see
* [Users:create](https://developers.docusign.com/docs/esign-rest-api/reference/Users/Users/create/).
*
*
*
*
* **Parameters:**
*
* * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `user_id: &str` -- The ID of the user to access. Generally this is the ID of the current authenticated user, but if the authenticated user is an Administrator on the account, `userId` can represent another user whom the Administrator is accessing.
* .
*/
pub async fn settings_get(
&self,
account_id: &str,
user_id: &str,
) -> Result<crate::types::UserSettingsInformation> {
let url = format!(
"/v2.1/accounts/{}/users/{}/settings",
crate::progenitor_support::encode_path(account_id),
crate::progenitor_support::encode_path(user_id),
);
self.client.get(&url, None).await
}
/**
* Updates the user account settings for a specified user.
*
* This function performs a `PUT` to the `/v2.1/accounts/{accountId}/users/{userId}/settings` endpoint.
*
* Updates the account settings list and email notification types for the specified user.
*
* **Parameters:**
*
* * `account_id: &str` -- The brand that envelope recipients see when a brand is not explicitly set.
* * `user_id: &str` -- The ID of the user to access. Generally this is the ID of the current authenticated user, but if the authenticated user is an Administrator on the account, `userId` can represent another user whom the Administrator is accessing.
* .
*/
pub async fn settings_put(
&self,
account_id: &str,
user_id: &str,
body: &crate::types::UserSettingsInformation,
) -> Result<()> {
let url = format!(
"/v2.1/accounts/{}/users/{}/settings",
crate::progenitor_support::encode_path(account_id),
crate::progenitor_support::encode_path(user_id),
);
self.client
.put(&url, Some(reqwest::Body::from(serde_json::to_vec(body)?)))
.await
}
}