/*
* 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 serde::{Deserialize, Serialize};
use crate::{apis::ResponseContent, models};
use super::{Error, configuration};
/// struct for typed errors of method [`assign_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AssignIssueError {
Status400(),
Status403(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateIssueError {
Status400(models::ErrorCollection),
Status401(models::ErrorCollection),
Status403(models::ErrorCollection),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`create_issues`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateIssuesError {
Status400(models::CreatedIssues),
Status401(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`delete_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteIssueError {
Status400(),
Status401(),
Status403(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`do_transition`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DoTransitionError {
Status400(),
Status401(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`edit_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum EditIssueError {
Status400(),
Status401(),
Status403(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_change_logs`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetChangeLogsError {
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_create_issue_meta`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCreateIssueMetaError {
Status401(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_edit_issue_meta`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetEditIssueMetaError {
Status401(),
Status403(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetIssueError {
Status401(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`get_transitions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTransitionsError {
Status401(),
Status404(),
UnknownValue(serde_json::Value),
}
/// struct for typed errors of method [`notify`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum NotifyError {
Status400(),
Status403(),
Status404(),
UnknownValue(serde_json::Value),
}
/// Assigns an issue to a user. Use this operation when the calling user does not have the *Edit Issues* permission but has the *Assign issue* permission for the project that the issue is in. If `name` or `accountId` is set to: * `\"-1\"`, the issue is assigned to the default assignee for the project. * `null`, the issue is set to unassigned. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse Projects* and *Assign Issues* [ project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
pub async fn assign_issue(configuration: &configuration::Configuration, issue_id_or_key: &str, user: models::User) -> Result<serde_json::Value, Error<AssignIssueError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_issue_id_or_key = issue_id_or_key;
let p_user = user;
let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/assignee", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
req_builder = req_builder.json(&p_user);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
serde_json::from_str(&content).map_err(Error::from)
} else {
let content = resp.text().await?;
let entity: Option<AssignIssueError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Creates an issue or, where the option to create subtasks is enabled in Jira, a subtask. A transition may be applied, to move the issue or subtask to a workflow step other than the default start step, and issue properties set. The content of the issue or subtask is defined using `update` and `fields`. The fields that can be set in the issue or subtask are determined using the [ Get create issue metadata](#api-rest-api-2-issue-createmeta-get). These are the same fields that appear on the issue's create screen. Creating a subtask differs from creating an issue as follows: * `issueType` must be set to a subtask issue type (use [ Get create issue metadata](#api-rest-api-2-issue-createmeta-get) to find subtask issue types). * `parent` must contain the ID or key of the parent issue. **[Permissions](#permissions) required:** *Browse projects* and *Create issues* [project permissions](https://confluence.atlassian.com/x/yodKLg) for the project in which the issue or subtask is created.
pub async fn create_issue(configuration: &configuration::Configuration, issue_update_details: models::IssueUpdateDetails, update_history: Option<bool>) -> Result<models::CreatedIssue, Error<CreateIssueError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_issue_update_details = issue_update_details;
let p_update_history = update_history;
let uri_str = format!("{}/rest/api/2/issue", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref param_value) = p_update_history {
req_builder = req_builder.query(&[("updateHistory", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
req_builder = req_builder.json(&p_issue_update_details);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
serde_json::from_str(&content).map_err(Error::from)
} else {
let content = resp.text().await?;
let entity: Option<CreateIssueError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Creates issues and, where the option to create subtasks is enabled in Jira, subtasks. Transitions may be applied, to move the issues or subtasks to a workflow step other than the default start step, and issue properties set. The content of each issue or subtask is defined using `update` and `fields`. The fields that can be set in the issue or subtask are determined using the [ Get create issue metadata](#api-rest-api-2-issue-createmeta-get). These are the same fields that appear on the issues' create screens. Creating a subtask differs from creating an issue as follows: * `issueType` must be set to a subtask issue type (use [ Get create issue metadata](#api-rest-api-2-issue-createmeta-get) to find subtask issue types). * `parent` the must contain the ID or key of the parent issue. **[Permissions](#permissions) required:** *Browse projects* and *Create issues* [project permissions](https://confluence.atlassian.com/x/yodKLg) for the project in which each issue or subtask is created.
pub async fn create_issues(configuration: &configuration::Configuration, issues_update_bean: models::IssuesUpdateBean) -> Result<models::CreatedIssues, Error<CreateIssuesError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_issues_update_bean = issues_update_bean;
let uri_str = format!("{}/rest/api/2/issue/bulk", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
req_builder = req_builder.json(&p_issues_update_bean);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
serde_json::from_str(&content).map_err(Error::from)
} else {
let content = resp.text().await?;
let entity: Option<CreateIssuesError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Deletes an issue. An issue cannot be deleted if it has one or more subtasks. To delete an issue with subtasks, set `deleteSubtasks`. This causes the issue's subtasks to be deleted with the issue. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse projects* and *Delete issues* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project containing the issue. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
pub async fn delete_issue(configuration: &configuration::Configuration, issue_id_or_key: &str, delete_subtasks: Option<&str>) -> Result<(), Error<DeleteIssueError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_issue_id_or_key = issue_id_or_key;
let p_delete_subtasks = delete_subtasks;
let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
if let Some(ref param_value) = p_delete_subtasks {
req_builder = req_builder.query(&[("deleteSubtasks", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
Ok(())
} else {
let content = resp.text().await?;
let entity: Option<DeleteIssueError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Performs an issue transition and, if the transition has a screen, updates the fields from the transition screen. sortByCategory To update the fields on the transition screen, specify the fields in the `fields` or `update` parameters in the request body. Get details about the fields using [ Get transitions](#api-rest-api-2-issue-issueIdOrKey-transitions-get) with the `transitions.fields` expand. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse projects* and *Transition issues* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
pub async fn do_transition(configuration: &configuration::Configuration, issue_id_or_key: &str, issue_update_details: models::IssueUpdateDetails) -> Result<serde_json::Value, Error<DoTransitionError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_issue_id_or_key = issue_id_or_key;
let p_issue_update_details = issue_update_details;
let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/transitions", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
req_builder = req_builder.json(&p_issue_update_details);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
serde_json::from_str(&content).map_err(Error::from)
} else {
let content = resp.text().await?;
let entity: Option<DoTransitionError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Edits an issue. A transition may be applied and issue properties updated as part of the edit. The edits to the issue's fields are defined using `update` and `fields`. The fields that can be edited are determined using [ Get edit issue metadata](#api-rest-api-2-issue-issueIdOrKey-editmeta-get). The parent field may be set by key or ID. For standard issue types, the parent may be removed by setting `update.parent.set.none` to *true*. Connect app users with admin permissions (from user permissions and app scopes) can override the screen security configuration using `overrideScreenSecurity` and `overrideEditableFlag`. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse projects* and *Edit issues* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
pub async fn edit_issue(configuration: &configuration::Configuration, issue_id_or_key: &str, issue_update_details: models::IssueUpdateDetails, notify_users: Option<bool>, override_screen_security: Option<bool>, override_editable_flag: Option<bool>) -> Result<serde_json::Value, Error<EditIssueError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_issue_id_or_key = issue_id_or_key;
let p_issue_update_details = issue_update_details;
let p_notify_users = notify_users;
let p_override_screen_security = override_screen_security;
let p_override_editable_flag = override_editable_flag;
let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
if let Some(ref param_value) = p_notify_users {
req_builder = req_builder.query(&[("notifyUsers", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_override_screen_security {
req_builder = req_builder.query(&[("overrideScreenSecurity", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_override_editable_flag {
req_builder = req_builder.query(&[("overrideEditableFlag", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
req_builder = req_builder.json(&p_issue_update_details);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
serde_json::from_str(&content).map_err(Error::from)
} else {
let content = resp.text().await?;
let entity: Option<EditIssueError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns a [paginated](#pagination) list of all changelogs for an issue sorted by date, starting from the oldest. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
pub async fn get_change_logs(configuration: &configuration::Configuration, issue_id_or_key: &str, start_at: Option<i32>, max_results: Option<i32>) -> Result<models::PageBeanChangelog, Error<GetChangeLogsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_issue_id_or_key = issue_id_or_key;
let p_start_at = start_at;
let p_max_results = max_results;
let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/changelog", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_start_at {
req_builder = req_builder.query(&[("startAt", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_max_results {
req_builder = req_builder.query(&[("maxResults", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
serde_json::from_str(&content).map_err(Error::from)
} else {
let content = resp.text().await?;
let entity: Option<GetChangeLogsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns details of projects, issue types within projects, and, when requested, the create screen fields for each issue type for the user. Use the information to populate the requests in [ Create issue](#api-rest-api-2-issue-post) and [Create issues](#api-rest-api-2-issue-bulk-post). The request can be restricted to specific projects or issue types using the query parameters. The response will contain information for the valid projects, issue types, or project and issue type combinations requested. Note that invalid project, issue type, or project and issue type combinations do not generate errors. This operation can be accessed anonymously. **[Permissions](#permissions) required:** *Create issues* [project permission](https://confluence.atlassian.com/x/yodKLg) in the requested projects.
pub async fn get_create_issue_meta(configuration: &configuration::Configuration, project_ids: Option<Vec<String>>, project_keys: Option<Vec<String>>, issuetype_ids: Option<Vec<String>>, issuetype_names: Option<Vec<String>>, expand: Option<&str>) -> Result<models::IssueCreateMetadata, Error<GetCreateIssueMetaError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_project_ids = project_ids;
let p_project_keys = project_keys;
let p_issuetype_ids = issuetype_ids;
let p_issuetype_names = issuetype_names;
let p_expand = expand;
let uri_str = format!("{}/rest/api/2/issue/createmeta", configuration.base_path);
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_project_ids {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("projectIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("projectIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_project_keys {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("projectKeys".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("projectKeys", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_issuetype_ids {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("issuetypeIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("issuetypeIds", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_issuetype_names {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("issuetypeNames".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("issuetypeNames", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_expand {
req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
serde_json::from_str(&content).map_err(Error::from)
} else {
let content = resp.text().await?;
let entity: Option<GetCreateIssueMetaError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns the edit screen fields for an issue that are visible to and editable by the user. Use the information to populate the requests in [Edit issue](#api-rest-api-2-issue-issueIdOrKey-put). Connect app users with admin permissions (from user permissions and app scopes) can return additional details using: * `overrideScreenSecurity` Returns hidden fields. * `overrideEditableFlag` Returns uneditable fields. For example, where an issue has a workflow status of closed none of its fields are editable. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. Note: For any fields to be editable the user must have the *Edit issues* [project permission](https://confluence.atlassian.com/x/yodKLg) for the issue.
pub async fn get_edit_issue_meta(configuration: &configuration::Configuration, issue_id_or_key: &str, override_screen_security: Option<bool>, override_editable_flag: Option<bool>) -> Result<models::IssueUpdateMetadata, Error<GetEditIssueMetaError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_issue_id_or_key = issue_id_or_key;
let p_override_screen_security = override_screen_security;
let p_override_editable_flag = override_editable_flag;
let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/editmeta", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_override_screen_security {
req_builder = req_builder.query(&[("overrideScreenSecurity", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_override_editable_flag {
req_builder = req_builder.query(&[("overrideEditableFlag", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
serde_json::from_str(&content).map_err(Error::from)
} else {
let content = resp.text().await?;
let entity: Option<GetEditIssueMetaError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns the details for an issue. The issue is identified by its ID or key, however, if the identifier doesn't match an issue, a case-insensitive search and check for moved issues is performed. If a matching issue is found its details are returned, a 302 or other redirect is **not** returned. The issue key returned in the response is the key of the issue found. This operation can be accessed anonymously. **[Permissions](#permissions) required:** * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
pub async fn get_issue(configuration: &configuration::Configuration, issue_id_or_key: &str, fields: Option<Vec<String>>, fields_by_keys: Option<bool>, expand: Option<&str>, properties: Option<Vec<String>>, update_history: Option<bool>) -> Result<models::IssueBean, Error<GetIssueError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_issue_id_or_key = issue_id_or_key;
let p_fields = fields;
let p_fields_by_keys = fields_by_keys;
let p_expand = expand;
let p_properties = properties;
let p_update_history = update_history;
let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_fields {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("fields".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("fields", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_fields_by_keys {
req_builder = req_builder.query(&[("fieldsByKeys", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_expand {
req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_properties {
req_builder = match "multi" {
"multi" => req_builder.query(¶m_value.into_iter().map(|p| ("properties".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => req_builder.query(&[("properties", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref param_value) = p_update_history {
req_builder = req_builder.query(&[("updateHistory", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
serde_json::from_str(&content).map_err(Error::from)
} else {
let content = resp.text().await?;
let entity: Option<GetIssueError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Returns either all transitions or a transition that can be performed by the user on an issue, based on the issue's status. Note, if a request is made for a transition that does not exist or cannot be performed on the issue, given its status, the response will return any empty transitions list. This operation can be accessed anonymously. **[Permissions](#permissions) required: A list or transition is returned only when the user has:** * *Browse projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue. However, if the user does not have the *Transition issues* [ project permission](https://confluence.atlassian.com/x/yodKLg) the response will not list any transitions.
pub async fn get_transitions(configuration: &configuration::Configuration, issue_id_or_key: &str, expand: Option<&str>, transition_id: Option<&str>, skip_remote_only_condition: Option<bool>, include_unavailable_transitions: Option<bool>, sort_by_ops_bar_and_status: Option<bool>) -> Result<models::Transitions, Error<GetTransitionsError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_issue_id_or_key = issue_id_or_key;
let p_expand = expand;
let p_transition_id = transition_id;
let p_skip_remote_only_condition = skip_remote_only_condition;
let p_include_unavailable_transitions = include_unavailable_transitions;
let p_sort_by_ops_bar_and_status = sort_by_ops_bar_and_status;
let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/transitions", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
if let Some(ref param_value) = p_expand {
req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_transition_id {
req_builder = req_builder.query(&[("transitionId", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_skip_remote_only_condition {
req_builder = req_builder.query(&[("skipRemoteOnlyCondition", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_include_unavailable_transitions {
req_builder = req_builder.query(&[("includeUnavailableTransitions", ¶m_value.to_string())]);
}
if let Some(ref param_value) = p_sort_by_ops_bar_and_status {
req_builder = req_builder.query(&[("sortByOpsBarAndStatus", ¶m_value.to_string())]);
}
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
serde_json::from_str(&content).map_err(Error::from)
} else {
let content = resp.text().await?;
let entity: Option<GetTransitionsError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}
/// Creates an email notification for an issue and adds it to the mail queue. **[Permissions](#permissions) required:** * *Browse Projects* [project permission](https://confluence.atlassian.com/x/yodKLg) for the project that the issue is in. * If [issue-level security](https://confluence.atlassian.com/x/J4lKLg) is configured, issue-level security permission to view the issue.
pub async fn notify(configuration: &configuration::Configuration, issue_id_or_key: &str, notification: models::Notification) -> Result<serde_json::Value, Error<NotifyError>> {
// add a prefix to parameters to efficiently prevent name collisions
let p_issue_id_or_key = issue_id_or_key;
let p_notification = notification;
let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/notify", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
if let Some(ref user_agent) = configuration.user_agent {
req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
}
if let Some(ref token) = configuration.oauth_access_token {
req_builder = req_builder.bearer_auth(token.to_owned());
};
if let Some(ref auth_conf) = configuration.basic_auth {
req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
};
req_builder = req_builder.json(&p_notification);
let req = req_builder.build()?;
let resp = configuration.client.execute(req).await?;
let status = resp.status();
if !status.is_client_error() && !status.is_server_error() {
let content = resp.text().await?;
serde_json::from_str(&content).map_err(Error::from)
} else {
let content = resp.text().await?;
let entity: Option<NotifyError> = serde_json::from_str(&content).ok();
Err(Error::ResponseError(ResponseContent { status, content, entity }))
}
}