/*
* The Jira Cloud platform REST API
*
* Jira Cloud platform REST API documentation
*
* The version of the OpenAPI document: 1001.0.0-SNAPSHOT
* Contact: ecosystem@atlassian.com
* Generated by: https://openapi-generator.tech
*/
use reqwest;
use crate::apis::ResponseContent;
use super::{Error, configuration};
/// struct for passing parameters to the method [`find_assignable_users`]
#[derive(Clone, Debug, Default)]
pub struct FindAssignableUsersParams {
/// 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.
pub query: Option<String>,
/// The sessionId of this request. SessionId is the same until the assignee is set.
pub session_id: Option<String>,
/// 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.
pub username: Option<String>,
/// A query string that is matched exactly against user `accountId`. Required, unless `query` is specified.
pub account_id: Option<String>,
/// The project ID or project key (case sensitive). Required, unless `issueKey` is specified.
pub project: Option<String>,
/// The key of the issue. Required, unless `project` is specified.
pub issue_key: Option<String>,
/// The index of the first item to return in a page of results (page offset).
pub start_at: Option<i32>,
/// 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.
pub max_results: Option<i32>,
/// The ID of the transition.
pub action_descriptor_id: Option<i32>,
pub recommend: Option<bool>
}
/// struct for passing parameters to the method [`find_bulk_assignable_users`]
#[derive(Clone, Debug, Default)]
pub struct FindBulkAssignableUsersParams {
/// A list of project keys (case sensitive). This parameter accepts a comma-separated list.
pub project_keys: String,
/// 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.
pub query: Option<String>,
/// 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.
pub username: Option<String>,
/// A query string that is matched exactly against user `accountId`. Required, unless `query` is specified.
pub account_id: Option<String>,
/// The index of the first item to return in a page of results (page offset).
pub start_at: Option<i32>,
/// The maximum number of items to return per page.
pub max_results: Option<i32>
}
/// struct for passing parameters to the method [`find_user_keys_by_query`]
#[derive(Clone, Debug, Default)]
pub struct FindUserKeysByQueryParams {
/// The search query.
pub query: String,
/// The index of the first item to return in a page of results (page offset).
pub start_at: Option<i64>,
/// The maximum number of items to return per page.
pub max_results: Option<i32>
}
/// struct for passing parameters to the method [`find_users`]
#[derive(Clone, Debug, Default)]
pub struct FindUsersParams {
/// 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.
pub query: Option<String>,
pub username: Option<String>,
/// A query string that is matched exactly against a user `accountId`. Required, unless `query` or `property` is specified.
pub account_id: Option<String>,
/// The index of the first item to return in a page of results (page offset).
pub start_at: Option<i32>,
/// The maximum number of items to return per page.
pub max_results: Option<i32>,
/// 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.
pub property: Option<String>
}
/// struct for passing parameters to the method [`find_users_by_query`]
#[derive(Clone, Debug, Default)]
pub struct FindUsersByQueryParams {
/// The search query.
pub query: String,
/// The index of the first item to return in a page of results (page offset).
pub start_at: Option<i64>,
/// The maximum number of items to return per page.
pub max_results: Option<i32>
}
/// struct for passing parameters to the method [`find_users_for_picker`]
#[derive(Clone, Debug, Default)]
pub struct FindUsersForPickerParams {
/// 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*.
pub query: String,
/// The maximum number of items to return. The total number of matched users is returned in `total`.
pub max_results: Option<i32>,
/// Include the URI to the user's avatar.
pub show_avatar: Option<bool>,
/// 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.
pub exclude: Option<Vec<String>>,
/// 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`.
pub exclude_account_ids: Option<Vec<String>>,
pub avatar_size: Option<String>,
pub exclude_connect_users: Option<bool>
}
/// struct for passing parameters to the method [`find_users_with_all_permissions`]
#[derive(Clone, Debug, Default)]
pub struct FindUsersWithAllPermissionsParams {
/// 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
pub permissions: String,
/// 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.
pub query: Option<String>,
/// 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.
pub username: Option<String>,
/// A query string that is matched exactly against user `accountId`. Required, unless `query` is specified.
pub account_id: Option<String>,
/// The issue key for the issue.
pub issue_key: Option<String>,
/// The project key for the project (case sensitive).
pub project_key: Option<String>,
/// The index of the first item to return in a page of results (page offset).
pub start_at: Option<i32>,
/// The maximum number of items to return per page.
pub max_results: Option<i32>
}
/// struct for passing parameters to the method [`find_users_with_browse_permission`]
#[derive(Clone, Debug, Default)]
pub struct FindUsersWithBrowsePermissionParams {
/// 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.
pub query: Option<String>,
/// 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.
pub username: Option<String>,
/// A query string that is matched exactly against user `accountId`. Required, unless `query` is specified.
pub account_id: Option<String>,
/// The issue key for the issue. Required, unless `projectKey` is specified.
pub issue_key: Option<String>,
/// The project key for the project (case sensitive). Required, unless `issueKey` is specified.
pub project_key: Option<String>,
/// The index of the first item to return in a page of results (page offset).
pub start_at: Option<i32>,
/// The maximum number of items to return per page.
pub max_results: Option<i32>
}
/// struct for typed successes of method [`find_assignable_users`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindAssignableUsersSuccess {
Status200(Vec<crate::models::User>),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`find_bulk_assignable_users`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindBulkAssignableUsersSuccess {
Status200(Vec<crate::models::User>),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`find_user_keys_by_query`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUserKeysByQuerySuccess {
Status200(crate::models::PageBeanUserKey),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`find_users`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUsersSuccess {
Status200(Vec<crate::models::User>),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`find_users_by_query`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUsersByQuerySuccess {
Status200(crate::models::PageBeanUser),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`find_users_for_picker`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUsersForPickerSuccess {
Status200(crate::models::FoundUsers),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`find_users_with_all_permissions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUsersWithAllPermissionsSuccess {
Status200(Vec<crate::models::User>),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`find_users_with_browse_permission`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUsersWithBrowsePermissionSuccess {
Status200(Vec<crate::models::User>),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`find_assignable_users`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindAssignableUsersError {
Status400(),
Status401(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`find_bulk_assignable_users`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindBulkAssignableUsersError {
Status400(),
Status401(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`find_user_keys_by_query`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUserKeysByQueryError {
Status400(),
Status401(),
Status403(),
Status408(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`find_users`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUsersError {
Status400(),
Status401(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`find_users_by_query`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUsersByQueryError {
Status400(),
Status401(),
Status403(),
Status408(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`find_users_for_picker`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUsersForPickerError {
Status400(),
Status401(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`find_users_with_all_permissions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUsersWithAllPermissionsError {
Status400(),
Status401(),
Status403(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`find_users_with_browse_permission`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum FindUsersWithBrowsePermissionError {
Status400(),
Status401(),
Status404(),
UnknownValue(serde_json::Value),
}
/// 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.
pub async fn find_assignable_users(configuration: &configuration::Configuration, params: FindAssignableUsersParams) -> Result<ResponseContent<FindAssignableUsersSuccess>, Error<FindAssignableUsersError>> {
let local_var_configuration = configuration;
// unbox the parameters
let query = params.query;
let session_id = params.session_id;
let username = params.username;
let account_id = params.account_id;
let project = params.project;
let issue_key = params.issue_key;
let start_at = params.start_at;
let max_results = params.max_results;
let action_descriptor_id = params.action_descriptor_id;
let recommend = params.recommend;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/user/assignable/search", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = query {
local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = session_id {
local_var_req_builder = local_var_req_builder.query(&[("sessionId", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = username {
local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = account_id {
local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = project {
local_var_req_builder = local_var_req_builder.query(&[("project", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = issue_key {
local_var_req_builder = local_var_req_builder.query(&[("issueKey", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = start_at {
local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = max_results {
local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = action_descriptor_id {
local_var_req_builder = local_var_req_builder.query(&[("actionDescriptorId", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = recommend {
local_var_req_builder = local_var_req_builder.query(&[("recommend", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<FindAssignableUsersSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<FindAssignableUsersError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// 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.
pub async fn find_bulk_assignable_users(configuration: &configuration::Configuration, params: FindBulkAssignableUsersParams) -> Result<ResponseContent<FindBulkAssignableUsersSuccess>, Error<FindBulkAssignableUsersError>> {
let local_var_configuration = configuration;
// unbox the parameters
let project_keys = params.project_keys;
let query = params.query;
let username = params.username;
let account_id = params.account_id;
let start_at = params.start_at;
let max_results = params.max_results;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/user/assignable/multiProjectSearch", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = query {
local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = username {
local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = account_id {
local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
}
local_var_req_builder = local_var_req_builder.query(&[("projectKeys", &project_keys.to_string())]);
if let Some(ref local_var_str) = start_at {
local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = max_results {
local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<FindBulkAssignableUsersSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<FindBulkAssignableUsersError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// 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\"`
pub async fn find_user_keys_by_query(configuration: &configuration::Configuration, params: FindUserKeysByQueryParams) -> Result<ResponseContent<FindUserKeysByQuerySuccess>, Error<FindUserKeysByQueryError>> {
let local_var_configuration = configuration;
// unbox the parameters
let query = params.query;
let start_at = params.start_at;
let max_results = params.max_results;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/user/search/query/key", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("query", &query.to_string())]);
if let Some(ref local_var_str) = start_at {
local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = max_results {
local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<FindUserKeysByQuerySuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<FindUserKeysByQueryError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// 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.
pub async fn find_users(configuration: &configuration::Configuration, params: FindUsersParams) -> Result<ResponseContent<FindUsersSuccess>, Error<FindUsersError>> {
let local_var_configuration = configuration;
// unbox the parameters
let query = params.query;
let username = params.username;
let account_id = params.account_id;
let start_at = params.start_at;
let max_results = params.max_results;
let property = params.property;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/user/search", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = query {
local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = username {
local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = account_id {
local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = start_at {
local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = max_results {
local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = property {
local_var_req_builder = local_var_req_builder.query(&[("property", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<FindUsersSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<FindUsersError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// 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\"`
pub async fn find_users_by_query(configuration: &configuration::Configuration, params: FindUsersByQueryParams) -> Result<ResponseContent<FindUsersByQuerySuccess>, Error<FindUsersByQueryError>> {
let local_var_configuration = configuration;
// unbox the parameters
let query = params.query;
let start_at = params.start_at;
let max_results = params.max_results;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/user/search/query", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("query", &query.to_string())]);
if let Some(ref local_var_str) = start_at {
local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = max_results {
local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<FindUsersByQuerySuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<FindUsersByQueryError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// 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.
pub async fn find_users_for_picker(configuration: &configuration::Configuration, params: FindUsersForPickerParams) -> Result<ResponseContent<FindUsersForPickerSuccess>, Error<FindUsersForPickerError>> {
let local_var_configuration = configuration;
// unbox the parameters
let query = params.query;
let max_results = params.max_results;
let show_avatar = params.show_avatar;
let exclude = params.exclude;
let exclude_account_ids = params.exclude_account_ids;
let avatar_size = params.avatar_size;
let exclude_connect_users = params.exclude_connect_users;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/user/picker", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
local_var_req_builder = local_var_req_builder.query(&[("query", &query.to_string())]);
if let Some(ref local_var_str) = max_results {
local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = show_avatar {
local_var_req_builder = local_var_req_builder.query(&[("showAvatar", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = exclude {
local_var_req_builder = match "multi" {
"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)>>()),
_ => local_var_req_builder.query(&[("exclude", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_str) = exclude_account_ids {
local_var_req_builder = match "multi" {
"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)>>()),
_ => local_var_req_builder.query(&[("excludeAccountIds", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_str) = avatar_size {
local_var_req_builder = local_var_req_builder.query(&[("avatarSize", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = exclude_connect_users {
local_var_req_builder = local_var_req_builder.query(&[("excludeConnectUsers", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<FindUsersForPickerSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<FindUsersForPickerError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// 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.
pub async fn find_users_with_all_permissions(configuration: &configuration::Configuration, params: FindUsersWithAllPermissionsParams) -> Result<ResponseContent<FindUsersWithAllPermissionsSuccess>, Error<FindUsersWithAllPermissionsError>> {
let local_var_configuration = configuration;
// unbox the parameters
let permissions = params.permissions;
let query = params.query;
let username = params.username;
let account_id = params.account_id;
let issue_key = params.issue_key;
let project_key = params.project_key;
let start_at = params.start_at;
let max_results = params.max_results;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/user/permission/search", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = query {
local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = username {
local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = account_id {
local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
}
local_var_req_builder = local_var_req_builder.query(&[("permissions", &permissions.to_string())]);
if let Some(ref local_var_str) = issue_key {
local_var_req_builder = local_var_req_builder.query(&[("issueKey", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = project_key {
local_var_req_builder = local_var_req_builder.query(&[("projectKey", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = start_at {
local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = max_results {
local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<FindUsersWithAllPermissionsSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<FindUsersWithAllPermissionsError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}
/// 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.
pub async fn find_users_with_browse_permission(configuration: &configuration::Configuration, params: FindUsersWithBrowsePermissionParams) -> Result<ResponseContent<FindUsersWithBrowsePermissionSuccess>, Error<FindUsersWithBrowsePermissionError>> {
let local_var_configuration = configuration;
// unbox the parameters
let query = params.query;
let username = params.username;
let account_id = params.account_id;
let issue_key = params.issue_key;
let project_key = params.project_key;
let start_at = params.start_at;
let max_results = params.max_results;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/user/viewissue/search", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
if let Some(ref local_var_str) = query {
local_var_req_builder = local_var_req_builder.query(&[("query", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = username {
local_var_req_builder = local_var_req_builder.query(&[("username", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = account_id {
local_var_req_builder = local_var_req_builder.query(&[("accountId", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = issue_key {
local_var_req_builder = local_var_req_builder.query(&[("issueKey", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = project_key {
local_var_req_builder = local_var_req_builder.query(&[("projectKey", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = start_at {
local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = max_results {
local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
}
if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
}
if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
};
if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
};
let local_var_req = local_var_req_builder.build()?;
let local_var_resp = local_var_client.execute(local_var_req).await?;
let local_var_status = local_var_resp.status();
let local_var_content = local_var_resp.text().await?;
if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
let local_var_entity: Option<FindUsersWithBrowsePermissionSuccess> = serde_json::from_str(&local_var_content).ok();
let local_var_result = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Ok(local_var_result)
} else {
let local_var_entity: Option<FindUsersWithBrowsePermissionError> = serde_json::from_str(&local_var_content).ok();
let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
Err(Error::ResponseError(local_var_error))
}
}