hi_jira2/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;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17/// struct for passing parameters to the method [`find_assignable_users`]
18#[derive(Clone, Debug, Default)]
19pub struct FindAssignableUsersParams {
20    /// A query string that is matched against user attributes, such as `displayName`, and `emailAddress`, to find relevant users. The string can match the prefix of the attribute's value. For example, *query=john* matches a user with a `displayName` of *John Smith* and a user with an `emailAddress` of *johnson@example.com*. Required, unless `username` or `accountId` is specified.
21    pub query: Option<String>,
22    /// The sessionId of this request. SessionId is the same until the assignee is set.
23    pub session_id: Option<String>,
24    /// This parameter is no longer available. See the [deprecation notice](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/) for details.
25    pub username: Option<String>,
26    /// A query string that is matched exactly against user `accountId`. Required, unless `query` is specified.
27    pub account_id: Option<String>,
28    /// The project ID or project key (case sensitive). Required, unless `issueKey` is specified.
29    pub project: Option<String>,
30    /// The key of the issue. Required, unless `project` is specified.
31    pub issue_key: Option<String>,
32    /// The index of the first item to return in a page of results (page offset).
33    pub start_at: Option<i32>,
34    /// The maximum number of items to return. This operation may return less than the maximum number of items even if more are available. The operation fetches users up to the maximum and then, from the fetched users, returns only the users that can be assigned to the issue.
35    pub max_results: Option<i32>,
36    /// The ID of the transition.
37    pub action_descriptor_id: Option<i32>,
38    pub recommend: Option<bool>
39}
40
41/// struct for passing parameters to the method [`find_bulk_assignable_users`]
42#[derive(Clone, Debug, Default)]
43pub struct FindBulkAssignableUsersParams {
44    /// A list of project keys (case sensitive). This parameter accepts a comma-separated list.
45    pub project_keys: String,
46    /// A query string that is matched against user attributes, such as `displayName` and `emailAddress`, to find relevant users. The string can match the prefix of the attribute's value. For example, *query=john* matches a user with a `displayName` of *John Smith* and a user with an `emailAddress` of *johnson@example.com*. Required, unless `accountId` is specified.
47    pub query: Option<String>,
48    /// This parameter is no longer available. See the [deprecation notice](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/) for details.
49    pub username: Option<String>,
50    /// A query string that is matched exactly against user `accountId`. Required, unless `query` is specified.
51    pub account_id: Option<String>,
52    /// The index of the first item to return in a page of results (page offset).
53    pub start_at: Option<i32>,
54    /// The maximum number of items to return per page.
55    pub max_results: Option<i32>
56}
57
58/// struct for passing parameters to the method [`find_user_keys_by_query`]
59#[derive(Clone, Debug, Default)]
60pub struct FindUserKeysByQueryParams {
61    /// The search query.
62    pub query: String,
63    /// The index of the first item to return in a page of results (page offset).
64    pub start_at: Option<i64>,
65    /// The maximum number of items to return per page.
66    pub max_results: Option<i32>
67}
68
69/// struct for passing parameters to the method [`find_users`]
70#[derive(Clone, Debug, Default)]
71pub struct FindUsersParams {
72    /// A query string that is matched against user attributes ( `displayName`, and `emailAddress`) to find relevant users. The string can match the prefix of the attribute's value. For example, *query=john* matches a user with a `displayName` of *John Smith* and a user with an `emailAddress` of *johnson@example.com*. Required, unless `accountId` or `property` is specified.
73    pub query: Option<String>,
74    pub username: Option<String>,
75    /// A query string that is matched exactly against a user `accountId`. Required, unless `query` or `property` is specified.
76    pub account_id: Option<String>,
77    /// The index of the first item to return in a page of results (page offset).
78    pub start_at: Option<i32>,
79    /// The maximum number of items to return per page.
80    pub max_results: Option<i32>,
81    /// A query string used to search properties. Property keys are specified by path, so property keys containing dot (.) or equals (=) characters cannot be used. The query string cannot be specified using a JSON object. Example: To search for the value of `nested` from `{\"something\":{\"nested\":1,\"other\":2}}` use `thepropertykey.something.nested=1`. Required, unless `accountId` or `query` is specified.
82    pub property: Option<String>
83}
84
85/// struct for passing parameters to the method [`find_users_by_query`]
86#[derive(Clone, Debug, Default)]
87pub struct FindUsersByQueryParams {
88    /// The search query.
89    pub query: String,
90    /// The index of the first item to return in a page of results (page offset).
91    pub start_at: Option<i64>,
92    /// The maximum number of items to return per page.
93    pub max_results: Option<i32>
94}
95
96/// struct for passing parameters to the method [`find_users_for_picker`]
97#[derive(Clone, Debug, Default)]
98pub struct FindUsersForPickerParams {
99    /// A query string that is matched against user attributes, such as `displayName`, and `emailAddress`, to find relevant users. The string can match the prefix of the attribute's value. For example, *query=john* matches a user with a `displayName` of *John Smith* and a user with an `emailAddress` of *johnson@example.com*.
100    pub query: String,
101    /// The maximum number of items to return. The total number of matched users is returned in `total`.
102    pub max_results: Option<i32>,
103    /// Include the URI to the user's avatar.
104    pub show_avatar: Option<bool>,
105    /// This parameter is no longer available. See the [deprecation notice](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/) for details.
106    pub exclude: Option<Vec<String>>,
107    /// A list of account IDs to exclude from the search results. This parameter accepts a comma-separated list. Multiple account IDs can also be provided using an ampersand-separated list. For example, `excludeAccountIds=5b10a2844c20165700ede21g,5b10a0effa615349cb016cd8&excludeAccountIds=5b10ac8d82e05b22cc7d4ef5`. Cannot be provided with `exclude`.
108    pub exclude_account_ids: Option<Vec<String>>,
109    pub avatar_size: Option<String>,
110    pub exclude_connect_users: Option<bool>
111}
112
113/// struct for passing parameters to the method [`find_users_with_all_permissions`]
114#[derive(Clone, Debug, Default)]
115pub struct FindUsersWithAllPermissionsParams {
116    /// A comma separated list of permissions. Permissions can be specified as any:   *  permission returned by [Get all permissions](#api-rest-api-2-permissions-get).  *  custom project permission added by Connect apps.  *  (deprecated) one of the following:           *  ASSIGNABLE\\_USER      *  ASSIGN\\_ISSUE      *  ATTACHMENT\\_DELETE\\_ALL      *  ATTACHMENT\\_DELETE\\_OWN      *  BROWSE      *  CLOSE\\_ISSUE      *  COMMENT\\_DELETE\\_ALL      *  COMMENT\\_DELETE\\_OWN      *  COMMENT\\_EDIT\\_ALL      *  COMMENT\\_EDIT\\_OWN      *  COMMENT\\_ISSUE      *  CREATE\\_ATTACHMENT      *  CREATE\\_ISSUE      *  DELETE\\_ISSUE      *  EDIT\\_ISSUE      *  LINK\\_ISSUE      *  MANAGE\\_WATCHER\\_LIST      *  MODIFY\\_REPORTER      *  MOVE\\_ISSUE      *  PROJECT\\_ADMIN      *  RESOLVE\\_ISSUE      *  SCHEDULE\\_ISSUE      *  SET\\_ISSUE\\_SECURITY      *  TRANSITION\\_ISSUE      *  VIEW\\_VERSION\\_CONTROL      *  VIEW\\_VOTERS\\_AND\\_WATCHERS      *  VIEW\\_WORKFLOW\\_READONLY      *  WORKLOG\\_DELETE\\_ALL      *  WORKLOG\\_DELETE\\_OWN      *  WORKLOG\\_EDIT\\_ALL      *  WORKLOG\\_EDIT\\_OWN      *  WORK\\_ISSUE
117    pub permissions: String,
118    /// A query string that is matched against user attributes, such as `displayName` and `emailAddress`, to find relevant users. The string can match the prefix of the attribute's value. For example, *query=john* matches a user with a `displayName` of *John Smith* and a user with an `emailAddress` of *johnson@example.com*. Required, unless `accountId` is specified.
119    pub query: Option<String>,
120    /// This parameter is no longer available. See the [deprecation notice](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/) for details.
121    pub username: Option<String>,
122    /// A query string that is matched exactly against user `accountId`. Required, unless `query` is specified.
123    pub account_id: Option<String>,
124    /// The issue key for the issue.
125    pub issue_key: Option<String>,
126    /// The project key for the project (case sensitive).
127    pub project_key: Option<String>,
128    /// The index of the first item to return in a page of results (page offset).
129    pub start_at: Option<i32>,
130    /// The maximum number of items to return per page.
131    pub max_results: Option<i32>
132}
133
134/// struct for passing parameters to the method [`find_users_with_browse_permission`]
135#[derive(Clone, Debug, Default)]
136pub struct FindUsersWithBrowsePermissionParams {
137    /// A query string that is matched against user attributes, such as `displayName` and `emailAddress`, to find relevant users. The string can match the prefix of the attribute's value. For example, *query=john* matches a user with a `displayName` of *John Smith* and a user with an `emailAddress` of *johnson@example.com*. Required, unless `accountId` is specified.
138    pub query: Option<String>,
139    /// This parameter is no longer available. See the [deprecation notice](https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/) for details.
140    pub username: Option<String>,
141    /// A query string that is matched exactly against user `accountId`. Required, unless `query` is specified.
142    pub account_id: Option<String>,
143    /// The issue key for the issue. Required, unless `projectKey` is specified.
144    pub issue_key: Option<String>,
145    /// The project key for the project (case sensitive). Required, unless `issueKey` is specified.
146    pub project_key: Option<String>,
147    /// The index of the first item to return in a page of results (page offset).
148    pub start_at: Option<i32>,
149    /// The maximum number of items to return per page.
150    pub max_results: Option<i32>
151}
152
153
154/// struct for typed errors of method [`find_assignable_users`]
155#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum FindAssignableUsersError {
158    Status400(),
159    Status401(),
160    Status404(),
161    UnknownValue(serde_json::Value),
162}
163
164/// struct for typed errors of method [`find_bulk_assignable_users`]
165#[derive(Debug, Clone, Serialize, Deserialize)]
166#[serde(untagged)]
167pub enum FindBulkAssignableUsersError {
168    Status400(),
169    Status401(),
170    Status404(),
171    UnknownValue(serde_json::Value),
172}
173
174/// struct for typed errors of method [`find_user_keys_by_query`]
175#[derive(Debug, Clone, Serialize, Deserialize)]
176#[serde(untagged)]
177pub enum FindUserKeysByQueryError {
178    Status400(),
179    Status401(),
180    Status403(),
181    Status408(),
182    UnknownValue(serde_json::Value),
183}
184
185/// struct for typed errors of method [`find_users`]
186#[derive(Debug, Clone, Serialize, Deserialize)]
187#[serde(untagged)]
188pub enum FindUsersError {
189    Status400(),
190    Status401(),
191    UnknownValue(serde_json::Value),
192}
193
194/// struct for typed errors of method [`find_users_by_query`]
195#[derive(Debug, Clone, Serialize, Deserialize)]
196#[serde(untagged)]
197pub enum FindUsersByQueryError {
198    Status400(),
199    Status401(),
200    Status403(),
201    Status408(),
202    UnknownValue(serde_json::Value),
203}
204
205/// struct for typed errors of method [`find_users_for_picker`]
206#[derive(Debug, Clone, Serialize, Deserialize)]
207#[serde(untagged)]
208pub enum FindUsersForPickerError {
209    Status400(),
210    Status401(),
211    UnknownValue(serde_json::Value),
212}
213
214/// struct for typed errors of method [`find_users_with_all_permissions`]
215#[derive(Debug, Clone, Serialize, Deserialize)]
216#[serde(untagged)]
217pub enum FindUsersWithAllPermissionsError {
218    Status400(),
219    Status401(),
220    Status403(),
221    Status404(),
222    UnknownValue(serde_json::Value),
223}
224
225/// struct for typed errors of method [`find_users_with_browse_permission`]
226#[derive(Debug, Clone, Serialize, Deserialize)]
227#[serde(untagged)]
228pub enum FindUsersWithBrowsePermissionError {
229    Status400(),
230    Status401(),
231    Status404(),
232    UnknownValue(serde_json::Value),
233}
234
235
236/// 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.  Privacy controls are applied to the response based on the users' preferences. This could mean, for example, that the user's email address is hidden. See the [Profile visibility overview](https://developer.atlassian.com/cloud/jira/platform/profile-visibility/) for more details.  **[Permissions](#permissions) required:** Permission to access Jira.
237pub async fn find_assignable_users(configuration: &configuration::Configuration, params: FindAssignableUsersParams) -> Result<Vec<crate::models::User>, Error<FindAssignableUsersError>> {
238    let local_var_configuration = configuration;
239
240    // unbox the parameters
241    let query = params.query;
242    let session_id = params.session_id;
243    let username = params.username;
244    let account_id = params.account_id;
245    let project = params.project;
246    let issue_key = params.issue_key;
247    let start_at = params.start_at;
248    let max_results = params.max_results;
249    let action_descriptor_id = params.action_descriptor_id;
250    let recommend = params.recommend;
251
252
253    let local_var_client = &local_var_configuration.client;
254
255    let local_var_uri_str = format!("{}/rest/api/2/user/assignable/search", local_var_configuration.base_path);
256    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
257
258    if let Some(ref local_var_str) = query {
259        local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
260    }
261    if let Some(ref local_var_str) = session_id {
262        local_var_req_builder = local_var_req_builder.query(&[("sessionId", &local_var_str.to_string())]);
263    }
264    if let Some(ref local_var_str) = username {
265        local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
266    }
267    if let Some(ref local_var_str) = account_id {
268        local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
269    }
270    if let Some(ref local_var_str) = project {
271        local_var_req_builder = local_var_req_builder.query(&[("project", &local_var_str.to_string())]);
272    }
273    if let Some(ref local_var_str) = issue_key {
274        local_var_req_builder = local_var_req_builder.query(&[("issueKey", &local_var_str.to_string())]);
275    }
276    if let Some(ref local_var_str) = start_at {
277        local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
278    }
279    if let Some(ref local_var_str) = max_results {
280        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
281    }
282    if let Some(ref local_var_str) = action_descriptor_id {
283        local_var_req_builder = local_var_req_builder.query(&[("actionDescriptorId", &local_var_str.to_string())]);
284    }
285    if let Some(ref local_var_str) = recommend {
286        local_var_req_builder = local_var_req_builder.query(&[("recommend", &local_var_str.to_string())]);
287    }
288    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
289        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
290    }
291    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
292        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
293    };
294    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
295        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
296    };
297
298    let local_var_req = local_var_req_builder.build()?;
299    let local_var_resp = local_var_client.execute(local_var_req).await?;
300
301    let local_var_status = local_var_resp.status();
302    let local_var_content = local_var_resp.text().await?;
303
304    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
305        serde_json::from_str(&local_var_content).map_err(Error::from)
306    } else {
307        let local_var_entity: Option<FindAssignableUsersError> = serde_json::from_str(&local_var_content).ok();
308        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
309        Err(Error::ResponseError(local_var_error))
310    }
311}
312
313/// 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.  Privacy controls are applied to the response based on the users' preferences. This could mean, for example, that the user's email address is hidden. See the [Profile visibility overview](https://developer.atlassian.com/cloud/jira/platform/profile-visibility/) for more details.  This operation can be accessed anonymously.  **[Permissions](#permissions) required:** None.
314pub async fn find_bulk_assignable_users(configuration: &configuration::Configuration, params: FindBulkAssignableUsersParams) -> Result<Vec<crate::models::User>, Error<FindBulkAssignableUsersError>> {
315    let local_var_configuration = configuration;
316
317    // unbox the parameters
318    let project_keys = params.project_keys;
319    let query = params.query;
320    let username = params.username;
321    let account_id = params.account_id;
322    let start_at = params.start_at;
323    let max_results = params.max_results;
324
325
326    let local_var_client = &local_var_configuration.client;
327
328    let local_var_uri_str = format!("{}/rest/api/2/user/assignable/multiProjectSearch", local_var_configuration.base_path);
329    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
330
331    if let Some(ref local_var_str) = query {
332        local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
333    }
334    if let Some(ref local_var_str) = username {
335        local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
336    }
337    if let Some(ref local_var_str) = account_id {
338        local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
339    }
340    local_var_req_builder = local_var_req_builder.query(&[("projectKeys", &project_keys.to_string())]);
341    if let Some(ref local_var_str) = start_at {
342        local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
343    }
344    if let Some(ref local_var_str) = max_results {
345        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
346    }
347    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
348        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
349    }
350    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
351        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
352    };
353    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
354        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
355    };
356
357    let local_var_req = local_var_req_builder.build()?;
358    let local_var_resp = local_var_client.execute(local_var_req).await?;
359
360    let local_var_status = local_var_resp.status();
361    let local_var_content = local_var_resp.text().await?;
362
363    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
364        serde_json::from_str(&local_var_content).map_err(Error::from)
365    } else {
366        let local_var_entity: Option<FindBulkAssignableUsersError> = serde_json::from_str(&local_var_content).ok();
367        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
368        Err(Error::ResponseError(local_var_error))
369    }
370}
371
372/// 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\"`
373pub async fn find_user_keys_by_query(configuration: &configuration::Configuration, params: FindUserKeysByQueryParams) -> Result<crate::models::PageBeanUserKey, Error<FindUserKeysByQueryError>> {
374    let local_var_configuration = configuration;
375
376    // unbox the parameters
377    let query = params.query;
378    let start_at = params.start_at;
379    let max_results = params.max_results;
380
381
382    let local_var_client = &local_var_configuration.client;
383
384    let local_var_uri_str = format!("{}/rest/api/2/user/search/query/key", local_var_configuration.base_path);
385    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
386
387    local_var_req_builder = local_var_req_builder.query(&[("query", &query.to_string())]);
388    if let Some(ref local_var_str) = start_at {
389        local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
390    }
391    if let Some(ref local_var_str) = max_results {
392        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
393    }
394    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
395        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
396    }
397    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
398        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
399    };
400    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
401        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
402    };
403
404    let local_var_req = local_var_req_builder.build()?;
405    let local_var_resp = local_var_client.execute(local_var_req).await?;
406
407    let local_var_status = local_var_resp.status();
408    let local_var_content = local_var_resp.text().await?;
409
410    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
411        serde_json::from_str(&local_var_content).map_err(Error::from)
412    } else {
413        let local_var_entity: Option<FindUserKeysByQueryError> = serde_json::from_str(&local_var_content).ok();
414        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
415        Err(Error::ResponseError(local_var_error))
416    }
417}
418
419/// 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.  Privacy controls are applied to the response based on the users' preferences. This could mean, for example, that the user's email address is hidden. See the [Profile visibility overview](https://developer.atlassian.com/cloud/jira/platform/profile-visibility/) for more details.  **[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.
420pub async fn find_users(configuration: &configuration::Configuration, params: FindUsersParams) -> Result<Vec<crate::models::User>, Error<FindUsersError>> {
421    let local_var_configuration = configuration;
422
423    // unbox the parameters
424    let query = params.query;
425    let username = params.username;
426    let account_id = params.account_id;
427    let start_at = params.start_at;
428    let max_results = params.max_results;
429    let property = params.property;
430
431
432    let local_var_client = &local_var_configuration.client;
433
434    let local_var_uri_str = format!("{}/rest/api/2/user/search", local_var_configuration.base_path);
435    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
436
437    if let Some(ref local_var_str) = query {
438        local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
439    }
440    if let Some(ref local_var_str) = username {
441        local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
442    }
443    if let Some(ref local_var_str) = account_id {
444        local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
445    }
446    if let Some(ref local_var_str) = start_at {
447        local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
448    }
449    if let Some(ref local_var_str) = max_results {
450        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
451    }
452    if let Some(ref local_var_str) = property {
453        local_var_req_builder = local_var_req_builder.query(&[("property", &local_var_str.to_string())]);
454    }
455    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
456        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
457    }
458    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
459        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
460    };
461    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
462        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
463    };
464
465    let local_var_req = local_var_req_builder.build()?;
466    let local_var_resp = local_var_client.execute(local_var_req).await?;
467
468    let local_var_status = local_var_resp.status();
469    let local_var_content = local_var_resp.text().await?;
470
471    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
472        serde_json::from_str(&local_var_content).map_err(Error::from)
473    } else {
474        let local_var_entity: Option<FindUsersError> = serde_json::from_str(&local_var_content).ok();
475        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
476        Err(Error::ResponseError(local_var_error))
477    }
478}
479
480/// 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\"`
481pub async fn find_users_by_query(configuration: &configuration::Configuration, params: FindUsersByQueryParams) -> Result<crate::models::PageBeanUser, Error<FindUsersByQueryError>> {
482    let local_var_configuration = configuration;
483
484    // unbox the parameters
485    let query = params.query;
486    let start_at = params.start_at;
487    let max_results = params.max_results;
488
489
490    let local_var_client = &local_var_configuration.client;
491
492    let local_var_uri_str = format!("{}/rest/api/2/user/search/query", local_var_configuration.base_path);
493    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
494
495    local_var_req_builder = local_var_req_builder.query(&[("query", &query.to_string())]);
496    if let Some(ref local_var_str) = start_at {
497        local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
498    }
499    if let Some(ref local_var_str) = max_results {
500        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
501    }
502    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
503        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
504    }
505    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
506        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
507    };
508    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
509        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
510    };
511
512    let local_var_req = local_var_req_builder.build()?;
513    let local_var_resp = local_var_client.execute(local_var_req).await?;
514
515    let local_var_status = local_var_resp.status();
516    let local_var_content = local_var_resp.text().await?;
517
518    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
519        serde_json::from_str(&local_var_content).map_err(Error::from)
520    } else {
521        let local_var_entity: Option<FindUsersByQueryError> = serde_json::from_str(&local_var_content).ok();
522        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
523        Err(Error::ResponseError(local_var_error))
524    }
525}
526
527/// 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.  Privacy controls are applied to the response based on the users' preferences. This could mean, for example, that the user's email address is hidden. See the [Profile visibility overview](https://developer.atlassian.com/cloud/jira/platform/profile-visibility/) for more details.  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.
528pub async fn find_users_for_picker(configuration: &configuration::Configuration, params: FindUsersForPickerParams) -> Result<crate::models::FoundUsers, Error<FindUsersForPickerError>> {
529    let local_var_configuration = configuration;
530
531    // unbox the parameters
532    let query = params.query;
533    let max_results = params.max_results;
534    let show_avatar = params.show_avatar;
535    let exclude = params.exclude;
536    let exclude_account_ids = params.exclude_account_ids;
537    let avatar_size = params.avatar_size;
538    let exclude_connect_users = params.exclude_connect_users;
539
540
541    let local_var_client = &local_var_configuration.client;
542
543    let local_var_uri_str = format!("{}/rest/api/2/user/picker", local_var_configuration.base_path);
544    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
545
546    local_var_req_builder = local_var_req_builder.query(&[("query", &query.to_string())]);
547    if let Some(ref local_var_str) = max_results {
548        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
549    }
550    if let Some(ref local_var_str) = show_avatar {
551        local_var_req_builder = local_var_req_builder.query(&[("showAvatar", &local_var_str.to_string())]);
552    }
553    if let Some(ref local_var_str) = exclude {
554        local_var_req_builder = match "multi" {
555            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("exclude".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
556            _ => local_var_req_builder.query(&[("exclude", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
557        };
558    }
559    if let Some(ref local_var_str) = exclude_account_ids {
560        local_var_req_builder = match "multi" {
561            "multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("excludeAccountIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
562            _ => local_var_req_builder.query(&[("excludeAccountIds", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
563        };
564    }
565    if let Some(ref local_var_str) = avatar_size {
566        local_var_req_builder = local_var_req_builder.query(&[("avatarSize", &local_var_str.to_string())]);
567    }
568    if let Some(ref local_var_str) = exclude_connect_users {
569        local_var_req_builder = local_var_req_builder.query(&[("excludeConnectUsers", &local_var_str.to_string())]);
570    }
571    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
572        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
573    }
574    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
575        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
576    };
577    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
578        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
579    };
580
581    let local_var_req = local_var_req_builder.build()?;
582    let local_var_resp = local_var_client.execute(local_var_req).await?;
583
584    let local_var_status = local_var_resp.status();
585    let local_var_content = local_var_resp.text().await?;
586
587    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
588        serde_json::from_str(&local_var_content).map_err(Error::from)
589    } else {
590        let local_var_entity: Option<FindUsersForPickerError> = serde_json::from_str(&local_var_content).ok();
591        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
592        Err(Error::ResponseError(local_var_error))
593    }
594}
595
596/// 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.  Privacy controls are applied to the response based on the users' preferences. This could mean, for example, that the user's email address is hidden. See the [Profile visibility overview](https://developer.atlassian.com/cloud/jira/platform/profile-visibility/) for more details.  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.
597pub async fn find_users_with_all_permissions(configuration: &configuration::Configuration, params: FindUsersWithAllPermissionsParams) -> Result<Vec<crate::models::User>, Error<FindUsersWithAllPermissionsError>> {
598    let local_var_configuration = configuration;
599
600    // unbox the parameters
601    let permissions = params.permissions;
602    let query = params.query;
603    let username = params.username;
604    let account_id = params.account_id;
605    let issue_key = params.issue_key;
606    let project_key = params.project_key;
607    let start_at = params.start_at;
608    let max_results = params.max_results;
609
610
611    let local_var_client = &local_var_configuration.client;
612
613    let local_var_uri_str = format!("{}/rest/api/2/user/permission/search", local_var_configuration.base_path);
614    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
615
616    if let Some(ref local_var_str) = query {
617        local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
618    }
619    if let Some(ref local_var_str) = username {
620        local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
621    }
622    if let Some(ref local_var_str) = account_id {
623        local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
624    }
625    local_var_req_builder = local_var_req_builder.query(&[("permissions", &permissions.to_string())]);
626    if let Some(ref local_var_str) = issue_key {
627        local_var_req_builder = local_var_req_builder.query(&[("issueKey", &local_var_str.to_string())]);
628    }
629    if let Some(ref local_var_str) = project_key {
630        local_var_req_builder = local_var_req_builder.query(&[("projectKey", &local_var_str.to_string())]);
631    }
632    if let Some(ref local_var_str) = start_at {
633        local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
634    }
635    if let Some(ref local_var_str) = max_results {
636        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
637    }
638    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
639        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
640    }
641    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
642        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
643    };
644    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
645        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
646    };
647
648    let local_var_req = local_var_req_builder.build()?;
649    let local_var_resp = local_var_client.execute(local_var_req).await?;
650
651    let local_var_status = local_var_resp.status();
652    let local_var_content = local_var_resp.text().await?;
653
654    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
655        serde_json::from_str(&local_var_content).map_err(Error::from)
656    } else {
657        let local_var_entity: Option<FindUsersWithAllPermissionsError> = serde_json::from_str(&local_var_content).ok();
658        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
659        Err(Error::ResponseError(local_var_error))
660    }
661}
662
663/// 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.  Privacy controls are applied to the response based on the users' preferences. This could mean, for example, that the user's email address is hidden. See the [Profile visibility overview](https://developer.atlassian.com/cloud/jira/platform/profile-visibility/) for more details.  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.
664pub async fn find_users_with_browse_permission(configuration: &configuration::Configuration, params: FindUsersWithBrowsePermissionParams) -> Result<Vec<crate::models::User>, Error<FindUsersWithBrowsePermissionError>> {
665    let local_var_configuration = configuration;
666
667    // unbox the parameters
668    let query = params.query;
669    let username = params.username;
670    let account_id = params.account_id;
671    let issue_key = params.issue_key;
672    let project_key = params.project_key;
673    let start_at = params.start_at;
674    let max_results = params.max_results;
675
676
677    let local_var_client = &local_var_configuration.client;
678
679    let local_var_uri_str = format!("{}/rest/api/2/user/viewissue/search", local_var_configuration.base_path);
680    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
681
682    if let Some(ref local_var_str) = query {
683        local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
684    }
685    if let Some(ref local_var_str) = username {
686        local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
687    }
688    if let Some(ref local_var_str) = account_id {
689        local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
690    }
691    if let Some(ref local_var_str) = issue_key {
692        local_var_req_builder = local_var_req_builder.query(&[("issueKey", &local_var_str.to_string())]);
693    }
694    if let Some(ref local_var_str) = project_key {
695        local_var_req_builder = local_var_req_builder.query(&[("projectKey", &local_var_str.to_string())]);
696    }
697    if let Some(ref local_var_str) = start_at {
698        local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
699    }
700    if let Some(ref local_var_str) = max_results {
701        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
702    }
703    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
704        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
705    }
706    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
707        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
708    };
709    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
710        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
711    };
712
713    let local_var_req = local_var_req_builder.build()?;
714    let local_var_resp = local_var_client.execute(local_var_req).await?;
715
716    let local_var_status = local_var_resp.status();
717    let local_var_content = local_var_resp.text().await?;
718
719    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
720        serde_json::from_str(&local_var_content).map_err(Error::from)
721    } else {
722        let local_var_entity: Option<FindUsersWithBrowsePermissionError> = serde_json::from_str(&local_var_content).ok();
723        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
724        Err(Error::ResponseError(local_var_error))
725    }
726}
727