jira_api_v2/apis/
user_search_api.rs

1/*
2 * The Jira Cloud platform REST API
3 *
4 * Jira Cloud platform REST API documentation
5 *
6 * The version of the OpenAPI document: 1001.0.0-SNAPSHOT
7 * Contact: ecosystem@atlassian.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`find_assignable_users`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum FindAssignableUsersError {
22    Status400(),
23    Status401(),
24    Status404(),
25    UnknownValue(serde_json::Value),
26}
27
28/// struct for typed errors of method [`find_bulk_assignable_users`]
29#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum FindBulkAssignableUsersError {
32    Status400(),
33    Status401(),
34    Status404(),
35    UnknownValue(serde_json::Value),
36}
37
38/// struct for typed errors of method [`find_user_keys_by_query`]
39#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum FindUserKeysByQueryError {
42    Status400(),
43    Status401(),
44    Status403(),
45    Status408(),
46    UnknownValue(serde_json::Value),
47}
48
49/// struct for typed errors of method [`find_users`]
50#[derive(Debug, Clone, Serialize, Deserialize)]
51#[serde(untagged)]
52pub enum FindUsersError {
53    Status400(),
54    Status401(),
55    UnknownValue(serde_json::Value),
56}
57
58/// struct for typed errors of method [`find_users_by_query`]
59#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum FindUsersByQueryError {
62    Status400(),
63    Status401(),
64    Status403(),
65    Status408(),
66    UnknownValue(serde_json::Value),
67}
68
69/// struct for typed errors of method [`find_users_for_picker`]
70#[derive(Debug, Clone, Serialize, Deserialize)]
71#[serde(untagged)]
72pub enum FindUsersForPickerError {
73    Status400(),
74    Status401(),
75    UnknownValue(serde_json::Value),
76}
77
78/// struct for typed errors of method [`find_users_with_all_permissions`]
79#[derive(Debug, Clone, Serialize, Deserialize)]
80#[serde(untagged)]
81pub enum FindUsersWithAllPermissionsError {
82    Status400(),
83    Status401(),
84    Status403(),
85    Status404(),
86    UnknownValue(serde_json::Value),
87}
88
89/// struct for typed errors of method [`find_users_with_browse_permission`]
90#[derive(Debug, Clone, Serialize, Deserialize)]
91#[serde(untagged)]
92pub enum FindUsersWithBrowsePermissionError {
93    Status400(),
94    Status401(),
95    Status404(),
96    UnknownValue(serde_json::Value),
97}
98
99
100/// Returns a list of users that can be assigned to an issue. Use this operation to find the list of users who can be assigned to:   *  a new issue, by providing the `projectKeyOrId`.  *  an updated issue, by providing the `issueKey`.  *  to an issue during a transition (workflow action), by providing the `issueKey` and the transition id in `actionDescriptorId`. You can obtain the IDs of an issue's valid transitions using the `transitions` option in the `expand` parameter of [ Get issue](#api-rest-api-2-issue-issueIdOrKey-get).  In all these cases, you can pass an account ID to determine if a user can be assigned to an issue. The user is returned in the response if they can be assigned to the issue or issue transition.  This operation takes the users in the range defined by `startAt` and `maxResults`, up to the thousandth user, and then returns only the users from that range that can be assigned the issue. This means the operation usually returns fewer users than specified in `maxResults`. To get all the users who can be assigned the issue, use [Get all users](#api-rest-api-2-users-search-get) and filter the records in your code.  **[Permissions](#permissions) required:** Permission to access Jira.
101pub async fn find_assignable_users(configuration: &configuration::Configuration, query: Option<&str>, session_id: Option<&str>, username: Option<&str>, account_id: Option<&str>, project: Option<&str>, issue_key: Option<&str>, start_at: Option<i32>, max_results: Option<i32>, action_descriptor_id: Option<i32>, recommend: Option<bool>) -> Result<Vec<models::User>, Error<FindAssignableUsersError>> {
102    // add a prefix to parameters to efficiently prevent name collisions
103    let p_query = query;
104    let p_session_id = session_id;
105    let p_username = username;
106    let p_account_id = account_id;
107    let p_project = project;
108    let p_issue_key = issue_key;
109    let p_start_at = start_at;
110    let p_max_results = max_results;
111    let p_action_descriptor_id = action_descriptor_id;
112    let p_recommend = recommend;
113
114    let uri_str = format!("{}/rest/api/2/user/assignable/search", configuration.base_path);
115    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
116
117    if let Some(ref param_value) = p_query {
118        req_builder = req_builder.query(&[("query", &param_value.to_string())]);
119    }
120    if let Some(ref param_value) = p_session_id {
121        req_builder = req_builder.query(&[("sessionId", &param_value.to_string())]);
122    }
123    if let Some(ref param_value) = p_username {
124        req_builder = req_builder.query(&[("username", &param_value.to_string())]);
125    }
126    if let Some(ref param_value) = p_account_id {
127        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
128    }
129    if let Some(ref param_value) = p_project {
130        req_builder = req_builder.query(&[("project", &param_value.to_string())]);
131    }
132    if let Some(ref param_value) = p_issue_key {
133        req_builder = req_builder.query(&[("issueKey", &param_value.to_string())]);
134    }
135    if let Some(ref param_value) = p_start_at {
136        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
137    }
138    if let Some(ref param_value) = p_max_results {
139        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
140    }
141    if let Some(ref param_value) = p_action_descriptor_id {
142        req_builder = req_builder.query(&[("actionDescriptorId", &param_value.to_string())]);
143    }
144    if let Some(ref param_value) = p_recommend {
145        req_builder = req_builder.query(&[("recommend", &param_value.to_string())]);
146    }
147    if let Some(ref user_agent) = configuration.user_agent {
148        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
149    }
150    if let Some(ref token) = configuration.oauth_access_token {
151        req_builder = req_builder.bearer_auth(token.to_owned());
152    };
153    if let Some(ref auth_conf) = configuration.basic_auth {
154        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
155    };
156
157    let req = req_builder.build()?;
158    let resp = configuration.client.execute(req).await?;
159
160    let status = resp.status();
161
162    if !status.is_client_error() && !status.is_server_error() {
163        let content = resp.text().await?;
164        serde_json::from_str(&content).map_err(Error::from)
165    } else {
166        let content = resp.text().await?;
167        let entity: Option<FindAssignableUsersError> = serde_json::from_str(&content).ok();
168        Err(Error::ResponseError(ResponseContent { status, content, entity }))
169    }
170}
171
172/// Returns a list of users who can be assigned issues in one or more projects. The list may be restricted to users whose attributes match a string.  This operation takes the users in the range defined by `startAt` and `maxResults`, up to the thousandth user, and then returns only the users from that range that can be assigned issues in the projects. This means the operation usually returns fewer users than specified in `maxResults`. To get all the users who can be assigned issues in the projects, use [Get all users](#api-rest-api-2-users-search-get) and filter the records in your code.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** None.
173pub async fn find_bulk_assignable_users(configuration: &configuration::Configuration, project_keys: &str, query: Option<&str>, username: Option<&str>, account_id: Option<&str>, start_at: Option<i32>, max_results: Option<i32>) -> Result<Vec<models::User>, Error<FindBulkAssignableUsersError>> {
174    // add a prefix to parameters to efficiently prevent name collisions
175    let p_project_keys = project_keys;
176    let p_query = query;
177    let p_username = username;
178    let p_account_id = account_id;
179    let p_start_at = start_at;
180    let p_max_results = max_results;
181
182    let uri_str = format!("{}/rest/api/2/user/assignable/multiProjectSearch", configuration.base_path);
183    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
184
185    if let Some(ref param_value) = p_query {
186        req_builder = req_builder.query(&[("query", &param_value.to_string())]);
187    }
188    if let Some(ref param_value) = p_username {
189        req_builder = req_builder.query(&[("username", &param_value.to_string())]);
190    }
191    if let Some(ref param_value) = p_account_id {
192        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
193    }
194    req_builder = req_builder.query(&[("projectKeys", &p_project_keys.to_string())]);
195    if let Some(ref param_value) = p_start_at {
196        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
197    }
198    if let Some(ref param_value) = p_max_results {
199        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
200    }
201    if let Some(ref user_agent) = configuration.user_agent {
202        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
203    }
204    if let Some(ref token) = configuration.oauth_access_token {
205        req_builder = req_builder.bearer_auth(token.to_owned());
206    };
207    if let Some(ref auth_conf) = configuration.basic_auth {
208        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
209    };
210
211    let req = req_builder.build()?;
212    let resp = configuration.client.execute(req).await?;
213
214    let status = resp.status();
215
216    if !status.is_client_error() && !status.is_server_error() {
217        let content = resp.text().await?;
218        serde_json::from_str(&content).map_err(Error::from)
219    } else {
220        let content = resp.text().await?;
221        let entity: Option<FindBulkAssignableUsersError> = serde_json::from_str(&content).ok();
222        Err(Error::ResponseError(ResponseContent { status, content, entity }))
223    }
224}
225
226/// Finds users with a structured query and returns a [paginated](#pagination) list of user keys.  This operation takes the users in the range defined by `startAt` and `maxResults`, up to the thousandth user, and then returns only the users from that range that match the structured query. This means the operation usually returns fewer users than specified in `maxResults`. To get all the users who match the structured query, use [Get all users](#api-rest-api-2-users-search-get) and filter the records in your code.  **[Permissions](#permissions) required:** *Browse users and groups* [global permission](https://confluence.atlassian.com/x/x4dKLg).  The query statements are:   *  `is assignee of PROJ` Returns the users that are assignees of at least one issue in project *PROJ*.  *  `is assignee of (PROJ-1, PROJ-2)` Returns users that are assignees on the issues *PROJ-1* or *PROJ-2*.  *  `is reporter of (PROJ-1, PROJ-2)` Returns users that are reporters on the issues *PROJ-1* or *PROJ-2*.  *  `is watcher of (PROJ-1, PROJ-2)` Returns users that are watchers on the issues *PROJ-1* or *PROJ-2*.  *  `is voter of (PROJ-1, PROJ-2)` Returns users that are voters on the issues *PROJ-1* or *PROJ-2*.  *  `is commenter of (PROJ-1, PROJ-2)` Returns users that have posted a comment on the issues *PROJ-1* or *PROJ-2*.  *  `is transitioner of (PROJ-1, PROJ-2)` Returns users that have performed a transition on issues *PROJ-1* or *PROJ-2*.  *  `[propertyKey].entity.property.path is \"property value\"` Returns users with the entity property value.  The list of issues can be extended as needed, as in *(PROJ-1, PROJ-2, ... PROJ-n)*. Statements can be combined using the `AND` and `OR` operators to form more complex queries. For example:  `is assignee of PROJ AND [propertyKey].entity.property.path is \"property value\"`
227pub async fn find_user_keys_by_query(configuration: &configuration::Configuration, query: &str, start_at: Option<i64>, max_results: Option<i32>) -> Result<models::PageBeanUserKey, Error<FindUserKeysByQueryError>> {
228    // add a prefix to parameters to efficiently prevent name collisions
229    let p_query = query;
230    let p_start_at = start_at;
231    let p_max_results = max_results;
232
233    let uri_str = format!("{}/rest/api/2/user/search/query/key", configuration.base_path);
234    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
235
236    req_builder = req_builder.query(&[("query", &p_query.to_string())]);
237    if let Some(ref param_value) = p_start_at {
238        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
239    }
240    if let Some(ref param_value) = p_max_results {
241        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
242    }
243    if let Some(ref user_agent) = configuration.user_agent {
244        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
245    }
246    if let Some(ref token) = configuration.oauth_access_token {
247        req_builder = req_builder.bearer_auth(token.to_owned());
248    };
249    if let Some(ref auth_conf) = configuration.basic_auth {
250        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
251    };
252
253    let req = req_builder.build()?;
254    let resp = configuration.client.execute(req).await?;
255
256    let status = resp.status();
257
258    if !status.is_client_error() && !status.is_server_error() {
259        let content = resp.text().await?;
260        serde_json::from_str(&content).map_err(Error::from)
261    } else {
262        let content = resp.text().await?;
263        let entity: Option<FindUserKeysByQueryError> = serde_json::from_str(&content).ok();
264        Err(Error::ResponseError(ResponseContent { status, content, entity }))
265    }
266}
267
268/// Returns a list of users that match the search string and property.  This operation takes the users in the range defined by `startAt` and `maxResults`, up to the thousandth user, and then returns only the users from that range that match the search string and property. This means the operation usually returns fewer users than specified in `maxResults`. To get all the users who match the search string and property, use [Get all users](#api-rest-api-2-users-search-get) and filter the records in your code.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** *Browse users and groups* [global permission](https://confluence.atlassian.com/x/x4dKLg). Anonymous calls or calls by users without the required permission return empty search results.
269pub async fn find_users(configuration: &configuration::Configuration, query: Option<&str>, username: Option<&str>, account_id: Option<&str>, start_at: Option<i32>, max_results: Option<i32>, property: Option<&str>) -> Result<Vec<models::User>, Error<FindUsersError>> {
270    // add a prefix to parameters to efficiently prevent name collisions
271    let p_query = query;
272    let p_username = username;
273    let p_account_id = account_id;
274    let p_start_at = start_at;
275    let p_max_results = max_results;
276    let p_property = property;
277
278    let uri_str = format!("{}/rest/api/2/user/search", configuration.base_path);
279    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
280
281    if let Some(ref param_value) = p_query {
282        req_builder = req_builder.query(&[("query", &param_value.to_string())]);
283    }
284    if let Some(ref param_value) = p_username {
285        req_builder = req_builder.query(&[("username", &param_value.to_string())]);
286    }
287    if let Some(ref param_value) = p_account_id {
288        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
289    }
290    if let Some(ref param_value) = p_start_at {
291        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
292    }
293    if let Some(ref param_value) = p_max_results {
294        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
295    }
296    if let Some(ref param_value) = p_property {
297        req_builder = req_builder.query(&[("property", &param_value.to_string())]);
298    }
299    if let Some(ref user_agent) = configuration.user_agent {
300        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
301    }
302    if let Some(ref token) = configuration.oauth_access_token {
303        req_builder = req_builder.bearer_auth(token.to_owned());
304    };
305    if let Some(ref auth_conf) = configuration.basic_auth {
306        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
307    };
308
309    let req = req_builder.build()?;
310    let resp = configuration.client.execute(req).await?;
311
312    let status = resp.status();
313
314    if !status.is_client_error() && !status.is_server_error() {
315        let content = resp.text().await?;
316        serde_json::from_str(&content).map_err(Error::from)
317    } else {
318        let content = resp.text().await?;
319        let entity: Option<FindUsersError> = serde_json::from_str(&content).ok();
320        Err(Error::ResponseError(ResponseContent { status, content, entity }))
321    }
322}
323
324/// Finds users with a structured query and returns a [paginated](#pagination) list of user details.  This operation takes the users in the range defined by `startAt` and `maxResults`, up to the thousandth user, and then returns only the users from that range that match the structured query. This means the operation usually returns fewer users than specified in `maxResults`. To get all the users who match the structured query, use [Get all users](#api-rest-api-2-users-search-get) and filter the records in your code.  **[Permissions](#permissions) required:** *Browse users and groups* [global permission](https://confluence.atlassian.com/x/x4dKLg).  The query statements are:   *  `is assignee of PROJ` Returns the users that are assignees of at least one issue in project *PROJ*.  *  `is assignee of (PROJ-1, PROJ-2)` Returns users that are assignees on the issues *PROJ-1* or *PROJ-2*.  *  `is reporter of (PROJ-1, PROJ-2)` Returns users that are reporters on the issues *PROJ-1* or *PROJ-2*.  *  `is watcher of (PROJ-1, PROJ-2)` Returns users that are watchers on the issues *PROJ-1* or *PROJ-2*.  *  `is voter of (PROJ-1, PROJ-2)` Returns users that are voters on the issues *PROJ-1* or *PROJ-2*.  *  `is commenter of (PROJ-1, PROJ-2)` Returns users that have posted a comment on the issues *PROJ-1* or *PROJ-2*.  *  `is transitioner of (PROJ-1, PROJ-2)` Returns users that have performed a transition on issues *PROJ-1* or *PROJ-2*.  *  `[propertyKey].entity.property.path is \"property value\"` Returns users with the entity property value.  The list of issues can be extended as needed, as in *(PROJ-1, PROJ-2, ... PROJ-n)*. Statements can be combined using the `AND` and `OR` operators to form more complex queries. For example:  `is assignee of PROJ AND [propertyKey].entity.property.path is \"property value\"`
325pub async fn find_users_by_query(configuration: &configuration::Configuration, query: &str, start_at: Option<i64>, max_results: Option<i32>) -> Result<models::PageBeanUser, Error<FindUsersByQueryError>> {
326    // add a prefix to parameters to efficiently prevent name collisions
327    let p_query = query;
328    let p_start_at = start_at;
329    let p_max_results = max_results;
330
331    let uri_str = format!("{}/rest/api/2/user/search/query", configuration.base_path);
332    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
333
334    req_builder = req_builder.query(&[("query", &p_query.to_string())]);
335    if let Some(ref param_value) = p_start_at {
336        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
337    }
338    if let Some(ref param_value) = p_max_results {
339        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
340    }
341    if let Some(ref user_agent) = configuration.user_agent {
342        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
343    }
344    if let Some(ref token) = configuration.oauth_access_token {
345        req_builder = req_builder.bearer_auth(token.to_owned());
346    };
347    if let Some(ref auth_conf) = configuration.basic_auth {
348        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
349    };
350
351    let req = req_builder.build()?;
352    let resp = configuration.client.execute(req).await?;
353
354    let status = resp.status();
355
356    if !status.is_client_error() && !status.is_server_error() {
357        let content = resp.text().await?;
358        serde_json::from_str(&content).map_err(Error::from)
359    } else {
360        let content = resp.text().await?;
361        let entity: Option<FindUsersByQueryError> = serde_json::from_str(&content).ok();
362        Err(Error::ResponseError(ResponseContent { status, content, entity }))
363    }
364}
365
366/// Returns a list of users whose attributes match the query term. The returned object includes the `html` field where the matched query term is highlighted with the HTML strong tag. A list of account IDs can be provided to exclude users from the results.  This operation takes the users in the range defined by `maxResults`, up to the thousandth user, and then returns only the users from that range that match the query term. This means the operation usually returns fewer users than specified in `maxResults`. To get all the users who match the query term, use [Get all users](#api-rest-api-2-users-search-get) and filter the records in your code.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** *Browse users and groups* [global permission](https://confluence.atlassian.com/x/x4dKLg). Anonymous calls and calls by users without the required permission return search results for an exact name match only.
367pub async fn find_users_for_picker(configuration: &configuration::Configuration, query: &str, max_results: Option<i32>, show_avatar: Option<bool>, exclude: Option<Vec<String>>, exclude_account_ids: Option<Vec<String>>, avatar_size: Option<&str>, exclude_connect_users: Option<bool>) -> Result<models::FoundUsers, Error<FindUsersForPickerError>> {
368    // add a prefix to parameters to efficiently prevent name collisions
369    let p_query = query;
370    let p_max_results = max_results;
371    let p_show_avatar = show_avatar;
372    let p_exclude = exclude;
373    let p_exclude_account_ids = exclude_account_ids;
374    let p_avatar_size = avatar_size;
375    let p_exclude_connect_users = exclude_connect_users;
376
377    let uri_str = format!("{}/rest/api/2/user/picker", configuration.base_path);
378    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
379
380    req_builder = req_builder.query(&[("query", &p_query.to_string())]);
381    if let Some(ref param_value) = p_max_results {
382        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
383    }
384    if let Some(ref param_value) = p_show_avatar {
385        req_builder = req_builder.query(&[("showAvatar", &param_value.to_string())]);
386    }
387    if let Some(ref param_value) = p_exclude {
388        req_builder = match "multi" {
389            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("exclude".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
390            _ => req_builder.query(&[("exclude", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
391        };
392    }
393    if let Some(ref param_value) = p_exclude_account_ids {
394        req_builder = match "multi" {
395            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("excludeAccountIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
396            _ => req_builder.query(&[("excludeAccountIds", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
397        };
398    }
399    if let Some(ref param_value) = p_avatar_size {
400        req_builder = req_builder.query(&[("avatarSize", &param_value.to_string())]);
401    }
402    if let Some(ref param_value) = p_exclude_connect_users {
403        req_builder = req_builder.query(&[("excludeConnectUsers", &param_value.to_string())]);
404    }
405    if let Some(ref user_agent) = configuration.user_agent {
406        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
407    }
408    if let Some(ref token) = configuration.oauth_access_token {
409        req_builder = req_builder.bearer_auth(token.to_owned());
410    };
411    if let Some(ref auth_conf) = configuration.basic_auth {
412        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
413    };
414
415    let req = req_builder.build()?;
416    let resp = configuration.client.execute(req).await?;
417
418    let status = resp.status();
419
420    if !status.is_client_error() && !status.is_server_error() {
421        let content = resp.text().await?;
422        serde_json::from_str(&content).map_err(Error::from)
423    } else {
424        let content = resp.text().await?;
425        let entity: Option<FindUsersForPickerError> = serde_json::from_str(&content).ok();
426        Err(Error::ResponseError(ResponseContent { status, content, entity }))
427    }
428}
429
430/// Returns a list of users who fulfill these criteria:   *  their user attributes match a search string.  *  they have a set of permissions for a project or issue.  If no search string is provided, a list of all users with the permissions is returned.  This operation takes the users in the range defined by `startAt` and `maxResults`, up to the thousandth user, and then returns only the users from that range that match the search string and have permission for the project or issue. This means the operation usually returns fewer users than specified in `maxResults`. To get all the users who match the search string and have permission for the project or issue, use [Get all users](#api-rest-api-2-users-search-get) and filter the records in your code.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:**   *  *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg), to get users for any project.  *  *Administer Projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for a project, to get users for that project.
431pub async fn find_users_with_all_permissions(configuration: &configuration::Configuration, permissions: &str, query: Option<&str>, username: Option<&str>, account_id: Option<&str>, issue_key: Option<&str>, project_key: Option<&str>, start_at: Option<i32>, max_results: Option<i32>) -> Result<Vec<models::User>, Error<FindUsersWithAllPermissionsError>> {
432    // add a prefix to parameters to efficiently prevent name collisions
433    let p_permissions = permissions;
434    let p_query = query;
435    let p_username = username;
436    let p_account_id = account_id;
437    let p_issue_key = issue_key;
438    let p_project_key = project_key;
439    let p_start_at = start_at;
440    let p_max_results = max_results;
441
442    let uri_str = format!("{}/rest/api/2/user/permission/search", configuration.base_path);
443    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
444
445    if let Some(ref param_value) = p_query {
446        req_builder = req_builder.query(&[("query", &param_value.to_string())]);
447    }
448    if let Some(ref param_value) = p_username {
449        req_builder = req_builder.query(&[("username", &param_value.to_string())]);
450    }
451    if let Some(ref param_value) = p_account_id {
452        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
453    }
454    req_builder = req_builder.query(&[("permissions", &p_permissions.to_string())]);
455    if let Some(ref param_value) = p_issue_key {
456        req_builder = req_builder.query(&[("issueKey", &param_value.to_string())]);
457    }
458    if let Some(ref param_value) = p_project_key {
459        req_builder = req_builder.query(&[("projectKey", &param_value.to_string())]);
460    }
461    if let Some(ref param_value) = p_start_at {
462        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
463    }
464    if let Some(ref param_value) = p_max_results {
465        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
466    }
467    if let Some(ref user_agent) = configuration.user_agent {
468        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
469    }
470    if let Some(ref token) = configuration.oauth_access_token {
471        req_builder = req_builder.bearer_auth(token.to_owned());
472    };
473    if let Some(ref auth_conf) = configuration.basic_auth {
474        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
475    };
476
477    let req = req_builder.build()?;
478    let resp = configuration.client.execute(req).await?;
479
480    let status = resp.status();
481
482    if !status.is_client_error() && !status.is_server_error() {
483        let content = resp.text().await?;
484        serde_json::from_str(&content).map_err(Error::from)
485    } else {
486        let content = resp.text().await?;
487        let entity: Option<FindUsersWithAllPermissionsError> = serde_json::from_str(&content).ok();
488        Err(Error::ResponseError(ResponseContent { status, content, entity }))
489    }
490}
491
492/// Returns a list of users who fulfill these criteria:   *  their user attributes match a search string.  *  they have permission to browse issues.  Use this resource to find users who can browse:   *  an issue, by providing the `issueKey`.  *  any issue in a project, by providing the `projectKey`.  This operation takes the users in the range defined by `startAt` and `maxResults`, up to the thousandth user, and then returns only the users from that range that match the search string and have permission to browse issues. This means the operation usually returns fewer users than specified in `maxResults`. To get all the users who match the search string and have permission to browse issues, use [Get all users](#api-rest-api-2-users-search-get) and filter the records in your code.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** *Browse users and groups* [global permission](https://confluence.atlassian.com/x/x4dKLg). Anonymous calls and calls by users without the required permission return empty search results.
493pub async fn find_users_with_browse_permission(configuration: &configuration::Configuration, query: Option<&str>, username: Option<&str>, account_id: Option<&str>, issue_key: Option<&str>, project_key: Option<&str>, start_at: Option<i32>, max_results: Option<i32>) -> Result<Vec<models::User>, Error<FindUsersWithBrowsePermissionError>> {
494    // add a prefix to parameters to efficiently prevent name collisions
495    let p_query = query;
496    let p_username = username;
497    let p_account_id = account_id;
498    let p_issue_key = issue_key;
499    let p_project_key = project_key;
500    let p_start_at = start_at;
501    let p_max_results = max_results;
502
503    let uri_str = format!("{}/rest/api/2/user/viewissue/search", configuration.base_path);
504    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
505
506    if let Some(ref param_value) = p_query {
507        req_builder = req_builder.query(&[("query", &param_value.to_string())]);
508    }
509    if let Some(ref param_value) = p_username {
510        req_builder = req_builder.query(&[("username", &param_value.to_string())]);
511    }
512    if let Some(ref param_value) = p_account_id {
513        req_builder = req_builder.query(&[("accountId", &param_value.to_string())]);
514    }
515    if let Some(ref param_value) = p_issue_key {
516        req_builder = req_builder.query(&[("issueKey", &param_value.to_string())]);
517    }
518    if let Some(ref param_value) = p_project_key {
519        req_builder = req_builder.query(&[("projectKey", &param_value.to_string())]);
520    }
521    if let Some(ref param_value) = p_start_at {
522        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
523    }
524    if let Some(ref param_value) = p_max_results {
525        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
526    }
527    if let Some(ref user_agent) = configuration.user_agent {
528        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
529    }
530    if let Some(ref token) = configuration.oauth_access_token {
531        req_builder = req_builder.bearer_auth(token.to_owned());
532    };
533    if let Some(ref auth_conf) = configuration.basic_auth {
534        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
535    };
536
537    let req = req_builder.build()?;
538    let resp = configuration.client.execute(req).await?;
539
540    let status = resp.status();
541
542    if !status.is_client_error() && !status.is_server_error() {
543        let content = resp.text().await?;
544        serde_json::from_str(&content).map_err(Error::from)
545    } else {
546        let content = resp.text().await?;
547        let entity: Option<FindUsersWithBrowsePermissionError> = serde_json::from_str(&content).ok();
548        Err(Error::ResponseError(ResponseContent { status, content, entity }))
549    }
550}
551