/*
* 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 [`assign_issue`]
#[derive(Clone, Debug, Default)]
pub struct AssignIssueParams {
/// The ID or key of the issue to be assigned.
pub issue_id_or_key: String,
/// The request object with the user that the issue is assigned to.
pub user: crate::models::User
}
/// struct for passing parameters to the method [`create_issue`]
#[derive(Clone, Debug, Default)]
pub struct CreateIssueParams {
pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
/// Whether the project in which the issue is created is added to the user's **Recently viewed** project list, as shown under **Projects** in Jira. When provided, the issue type and request type are added to the user's history for a project. These values are then used to provide defaults on the issue create screen.
pub update_history: Option<bool>
}
/// struct for passing parameters to the method [`create_issues`]
#[derive(Clone, Debug, Default)]
pub struct CreateIssuesParams {
pub request_body: ::std::collections::HashMap<String, serde_json::Value>
}
/// struct for passing parameters to the method [`delete_issue`]
#[derive(Clone, Debug, Default)]
pub struct DeleteIssueParams {
/// The ID or key of the issue.
pub issue_id_or_key: String,
/// Whether the issue's subtasks are deleted when the issue is deleted.
pub delete_subtasks: Option<String>
}
/// struct for passing parameters to the method [`do_transition`]
#[derive(Clone, Debug, Default)]
pub struct DoTransitionParams {
/// The ID or key of the issue.
pub issue_id_or_key: String,
pub request_body: ::std::collections::HashMap<String, serde_json::Value>
}
/// struct for passing parameters to the method [`edit_issue`]
#[derive(Clone, Debug, Default)]
pub struct EditIssueParams {
/// The ID or key of the issue.
pub issue_id_or_key: String,
pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
/// Whether a notification email about the issue update is sent to all watchers. To disable the notification, administer Jira or administer project permissions are required. If the user doesn't have the necessary permission the request is ignored.
pub notify_users: Option<bool>,
/// Whether screen security is overridden to enable hidden fields to be edited. Available to Connect app users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) and Forge apps acting on behalf of users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub override_screen_security: Option<bool>,
/// Whether screen security is overridden to enable uneditable fields to be edited. Available to Connect app users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) and Forge apps acting on behalf of users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub override_editable_flag: Option<bool>
}
/// struct for passing parameters to the method [`get_change_logs`]
#[derive(Clone, Debug, Default)]
pub struct GetChangeLogsParams {
/// The ID or key of the issue.
pub issue_id_or_key: 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 [`get_change_logs_by_ids`]
#[derive(Clone, Debug, Default)]
pub struct GetChangeLogsByIdsParams {
/// The ID or key of the issue.
pub issue_id_or_key: String,
pub issue_changelog_ids: crate::models::IssueChangelogIds
}
/// struct for passing parameters to the method [`get_create_issue_meta`]
#[derive(Clone, Debug, Default)]
pub struct GetCreateIssueMetaParams {
/// List of project IDs. This parameter accepts a comma-separated list. Multiple project IDs can also be provided using an ampersand-separated list. For example, `projectIds=10000,10001&projectIds=10020,10021`. This parameter may be provided with `projectKeys`.
pub project_ids: Option<Vec<String>>,
/// List of project keys. This parameter accepts a comma-separated list. Multiple project keys can also be provided using an ampersand-separated list. For example, `projectKeys=proj1,proj2&projectKeys=proj3`. This parameter may be provided with `projectIds`.
pub project_keys: Option<Vec<String>>,
/// List of issue type IDs. This parameter accepts a comma-separated list. Multiple issue type IDs can also be provided using an ampersand-separated list. For example, `issuetypeIds=10000,10001&issuetypeIds=10020,10021`. This parameter may be provided with `issuetypeNames`.
pub issuetype_ids: Option<Vec<String>>,
/// List of issue type names. This parameter accepts a comma-separated list. Multiple issue type names can also be provided using an ampersand-separated list. For example, `issuetypeNames=name1,name2&issuetypeNames=name3`. This parameter may be provided with `issuetypeIds`.
pub issuetype_names: Option<Vec<String>>,
/// Use [expand](#expansion) to include additional information about issue metadata in the response. This parameter accepts `projects.issuetypes.fields`, which returns information about the fields in the issue creation screen for each issue type. Fields hidden from the screen are not returned. Use the information to populate the `fields` and `update` fields in [Create issue](#api-rest-api-2-issue-post) and [Create issues](#api-rest-api-2-issue-bulk-post).
pub expand: Option<String>
}
/// struct for passing parameters to the method [`get_edit_issue_meta`]
#[derive(Clone, Debug, Default)]
pub struct GetEditIssueMetaParams {
/// The ID or key of the issue.
pub issue_id_or_key: String,
/// Whether hidden fields are returned. Available to Connect app users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) and Forge apps acting on behalf of users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub override_screen_security: Option<bool>,
/// Whether non-editable fields are returned. Available to Connect app users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg) and Forge apps acting on behalf of users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub override_editable_flag: Option<bool>
}
/// struct for passing parameters to the method [`get_issue`]
#[derive(Clone, Debug, Default)]
pub struct GetIssueParams {
/// The ID or key of the issue.
pub issue_id_or_key: String,
/// A list of fields to return for the issue. This parameter accepts a comma-separated list. Use it to retrieve a subset of fields. Allowed values: * `*all` Returns all fields. * `*navigable` Returns navigable fields. * Any issue field, prefixed with a minus to exclude. Examples: * `summary,comment` Returns only the summary and comments fields. * `-description` Returns all (default) fields except description. * `*navigable,-comment` Returns all navigable fields except comment. This parameter may be specified multiple times. For example, `fields=field1,field2& fields=field3`. Note: All fields are returned by default. This differs from [Search for issues using JQL (GET)](#api-rest-api-2-search-get) and [Search for issues using JQL (POST)](#api-rest-api-2-search-post) where the default is all navigable fields.
pub fields: Option<Vec<String>>,
/// Whether fields in `fields` are referenced by keys rather than IDs. This parameter is useful where fields have been added by a connect app and a field's key may differ from its ID.
pub fields_by_keys: Option<bool>,
/// Use [expand](#expansion) to include additional information about the issues in the response. This parameter accepts a comma-separated list. Expand options include: * `renderedFields` Returns field values rendered in HTML format. * `names` Returns the display name of each field. * `schema` Returns the schema describing a field type. * `transitions` Returns all possible transitions for the issue. * `editmeta` Returns information about how each field can be edited. * `changelog` Returns a list of recent updates to an issue, sorted by date, starting from the most recent. * `versionedRepresentations` Returns a JSON array for each version of a field's value, with the highest number representing the most recent version. Note: When included in the request, the `fields` parameter is ignored.
pub expand: Option<String>,
/// A list of issue properties to return for the issue. This parameter accepts a comma-separated list. Allowed values: * `*all` Returns all issue properties. * Any issue property key, prefixed with a minus to exclude. Examples: * `*all` Returns all properties. * `*all,-prop1` Returns all properties except `prop1`. * `prop1,prop2` Returns `prop1` and `prop2` properties. This parameter may be specified multiple times. For example, `properties=prop1,prop2& properties=prop3`.
pub properties: Option<Vec<String>>,
/// Whether the project in which the issue is created is added to the user's **Recently viewed** project list, as shown under **Projects** in Jira. This also populates the [JQL issues search](#api-rest-api-2-search-get) `lastViewed` field.
pub update_history: Option<bool>
}
/// struct for passing parameters to the method [`get_transitions`]
#[derive(Clone, Debug, Default)]
pub struct GetTransitionsParams {
/// The ID or key of the issue.
pub issue_id_or_key: String,
/// Use [expand](#expansion) to include additional information about transitions in the response. This parameter accepts `transitions.fields`, which returns information about the fields in the transition screen for each transition. Fields hidden from the screen are not returned. Use this information to populate the `fields` and `update` fields in [Transition issue](#api-rest-api-2-issue-issueIdOrKey-transitions-post).
pub expand: Option<String>,
/// The ID of the transition.
pub transition_id: Option<String>,
/// Whether transitions with the condition *Hide From User Condition* are included in the response.
pub skip_remote_only_condition: Option<bool>,
/// Whether details of transitions that fail a condition are included in the response
pub include_unavailable_transitions: Option<bool>,
/// Whether the transitions are sorted by ops-bar sequence value first then category order (Todo, In Progress, Done) or only by ops-bar sequence value.
pub sort_by_ops_bar_and_status: Option<bool>
}
/// struct for passing parameters to the method [`notify`]
#[derive(Clone, Debug, Default)]
pub struct NotifyParams {
/// ID or key of the issue that the notification is sent for.
pub issue_id_or_key: String,
/// The request object for the notification and recipients.
pub request_body: ::std::collections::HashMap<String, serde_json::Value>
}
/// struct for typed successes of method [`assign_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum AssignIssueSuccess {
Status204(serde_json::Value),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`create_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateIssueSuccess {
Status201(crate::models::CreatedIssue),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`create_issues`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum CreateIssuesSuccess {
Status201(crate::models::CreatedIssues),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`delete_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DeleteIssueSuccess {
Status204(),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`do_transition`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum DoTransitionSuccess {
Status204(serde_json::Value),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`edit_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum EditIssueSuccess {
Status204(serde_json::Value),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_change_logs`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetChangeLogsSuccess {
Status200(crate::models::PageBeanChangelog),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_change_logs_by_ids`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetChangeLogsByIdsSuccess {
Status200(crate::models::PageOfChangelogs),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_create_issue_meta`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetCreateIssueMetaSuccess {
Status200(crate::models::IssueCreateMetadata),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_edit_issue_meta`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetEditIssueMetaSuccess {
Status200(crate::models::IssueUpdateMetadata),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_events`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetEventsSuccess {
Status200(Vec<crate::models::IssueEvent>),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_issue`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetIssueSuccess {
Status200(crate::models::IssueBean),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`get_transitions`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetTransitionsSuccess {
Status200(crate::models::Transitions),
UnknownValue(serde_json::Value),
}
/// struct for typed successes of method [`notify`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum NotifySuccess {
Status204(serde_json::Value),
UnknownValue(serde_json::Value),
}
/// 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(crate::models::ErrorCollection),
Status401(crate::models::ErrorCollection),
Status403(crate::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(crate::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_change_logs_by_ids`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetChangeLogsByIdsError {
Status400(),
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_events`]
#[derive(Debug, Clone, Serialize, Deserialize)]
#[serde(untagged)]
pub enum GetEventsError {
Status401(),
Status403(),
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, params: AssignIssueParams) -> Result<ResponseContent<AssignIssueSuccess>, Error<AssignIssueError>> {
let local_var_configuration = configuration;
// unbox the parameters
let issue_id_or_key = params.issue_id_or_key;
let user = params.user;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/assignee", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
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());
};
local_var_req_builder = local_var_req_builder.json(&user);
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<AssignIssueSuccess> = 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<AssignIssueError> = 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))
}
}
/// 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, params: CreateIssueParams) -> Result<ResponseContent<CreateIssueSuccess>, Error<CreateIssueError>> {
let local_var_configuration = configuration;
// unbox the parameters
let request_body = params.request_body;
let update_history = params.update_history;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
if let Some(ref local_var_str) = update_history {
local_var_req_builder = local_var_req_builder.query(&[("updateHistory", &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());
};
local_var_req_builder = local_var_req_builder.json(&request_body);
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<CreateIssueSuccess> = 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<CreateIssueError> = 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))
}
}
/// Creates upto **50** 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, params: CreateIssuesParams) -> Result<ResponseContent<CreateIssuesSuccess>, Error<CreateIssuesError>> {
let local_var_configuration = configuration;
// unbox the parameters
let request_body = params.request_body;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue/bulk", local_var_configuration.base_path);
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
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());
};
local_var_req_builder = local_var_req_builder.json(&request_body);
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<CreateIssuesSuccess> = 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<CreateIssuesError> = 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))
}
}
/// 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, params: DeleteIssueParams) -> Result<ResponseContent<DeleteIssueSuccess>, Error<DeleteIssueError>> {
let local_var_configuration = configuration;
// unbox the parameters
let issue_id_or_key = params.issue_id_or_key;
let delete_subtasks = params.delete_subtasks;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
if let Some(ref local_var_str) = delete_subtasks {
local_var_req_builder = local_var_req_builder.query(&[("deleteSubtasks", &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<DeleteIssueSuccess> = 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<DeleteIssueError> = 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))
}
}
/// 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, params: DoTransitionParams) -> Result<ResponseContent<DoTransitionSuccess>, Error<DoTransitionError>> {
let local_var_configuration = configuration;
// unbox the parameters
let issue_id_or_key = params.issue_id_or_key;
let request_body = params.request_body;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/transitions", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
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());
};
local_var_req_builder = local_var_req_builder.json(&request_body);
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<DoTransitionSuccess> = 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<DoTransitionError> = 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))
}
}
/// 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 apps having an app user with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg), and Forge apps acting on behalf of users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg), 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, params: EditIssueParams) -> Result<ResponseContent<EditIssueSuccess>, Error<EditIssueError>> {
let local_var_configuration = configuration;
// unbox the parameters
let issue_id_or_key = params.issue_id_or_key;
let request_body = params.request_body;
let notify_users = params.notify_users;
let override_screen_security = params.override_screen_security;
let override_editable_flag = params.override_editable_flag;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
if let Some(ref local_var_str) = notify_users {
local_var_req_builder = local_var_req_builder.query(&[("notifyUsers", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = override_screen_security {
local_var_req_builder = local_var_req_builder.query(&[("overrideScreenSecurity", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = override_editable_flag {
local_var_req_builder = local_var_req_builder.query(&[("overrideEditableFlag", &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());
};
local_var_req_builder = local_var_req_builder.json(&request_body);
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<EditIssueSuccess> = 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<EditIssueError> = 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 [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, params: GetChangeLogsParams) -> Result<ResponseContent<GetChangeLogsSuccess>, Error<GetChangeLogsError>> {
let local_var_configuration = configuration;
// unbox the parameters
let issue_id_or_key = params.issue_id_or_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/issue/{issueIdOrKey}/changelog", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
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) = 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<GetChangeLogsSuccess> = 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<GetChangeLogsError> = 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 changelogs for an issue specified by a list of changelog IDs. 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_by_ids(configuration: &configuration::Configuration, params: GetChangeLogsByIdsParams) -> Result<ResponseContent<GetChangeLogsByIdsSuccess>, Error<GetChangeLogsByIdsError>> {
let local_var_configuration = configuration;
// unbox the parameters
let issue_id_or_key = params.issue_id_or_key;
let issue_changelog_ids = params.issue_changelog_ids;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/changelog/list", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
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());
};
local_var_req_builder = local_var_req_builder.json(&issue_changelog_ids);
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<GetChangeLogsByIdsSuccess> = 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<GetChangeLogsByIdsError> = 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 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, params: GetCreateIssueMetaParams) -> Result<ResponseContent<GetCreateIssueMetaSuccess>, Error<GetCreateIssueMetaError>> {
let local_var_configuration = configuration;
// unbox the parameters
let project_ids = params.project_ids;
let project_keys = params.project_keys;
let issuetype_ids = params.issuetype_ids;
let issuetype_names = params.issuetype_names;
let expand = params.expand;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue/createmeta", 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) = project_ids {
local_var_req_builder = match "multi" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("projectIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("projectIds", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_str) = project_keys {
local_var_req_builder = match "multi" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("projectKeys".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("projectKeys", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_str) = issuetype_ids {
local_var_req_builder = match "multi" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("issuetypeIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("issuetypeIds", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_str) = issuetype_names {
local_var_req_builder = match "multi" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("issuetypeNames".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("issuetypeNames", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_str) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &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<GetCreateIssueMetaSuccess> = 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<GetCreateIssueMetaError> = 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 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 apps having an app user with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg), and Forge apps acting on behalf of users with *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg), 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, params: GetEditIssueMetaParams) -> Result<ResponseContent<GetEditIssueMetaSuccess>, Error<GetEditIssueMetaError>> {
let local_var_configuration = configuration;
// unbox the parameters
let issue_id_or_key = params.issue_id_or_key;
let override_screen_security = params.override_screen_security;
let override_editable_flag = params.override_editable_flag;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/editmeta", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
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) = override_screen_security {
local_var_req_builder = local_var_req_builder.query(&[("overrideScreenSecurity", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = override_editable_flag {
local_var_req_builder = local_var_req_builder.query(&[("overrideEditableFlag", &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<GetEditIssueMetaSuccess> = 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<GetEditIssueMetaError> = 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 all issue events. **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
pub async fn get_events(configuration: &configuration::Configuration) -> Result<ResponseContent<GetEventsSuccess>, Error<GetEventsError>> {
let local_var_configuration = configuration;
// unbox the parameters
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/events", 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_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<GetEventsSuccess> = 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<GetEventsError> = 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 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, params: GetIssueParams) -> Result<ResponseContent<GetIssueSuccess>, Error<GetIssueError>> {
let local_var_configuration = configuration;
// unbox the parameters
let issue_id_or_key = params.issue_id_or_key;
let fields = params.fields;
let fields_by_keys = params.fields_by_keys;
let expand = params.expand;
let properties = params.properties;
let update_history = params.update_history;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
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) = fields {
local_var_req_builder = match "multi" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("fields".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("fields", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_str) = fields_by_keys {
local_var_req_builder = local_var_req_builder.query(&[("fieldsByKeys", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = properties {
local_var_req_builder = match "multi" {
"multi" => local_var_req_builder.query(&local_var_str.into_iter().map(|p| ("properties".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
_ => local_var_req_builder.query(&[("properties", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
};
}
if let Some(ref local_var_str) = update_history {
local_var_req_builder = local_var_req_builder.query(&[("updateHistory", &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<GetIssueSuccess> = 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<GetIssueError> = 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 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, params: GetTransitionsParams) -> Result<ResponseContent<GetTransitionsSuccess>, Error<GetTransitionsError>> {
let local_var_configuration = configuration;
// unbox the parameters
let issue_id_or_key = params.issue_id_or_key;
let expand = params.expand;
let transition_id = params.transition_id;
let skip_remote_only_condition = params.skip_remote_only_condition;
let include_unavailable_transitions = params.include_unavailable_transitions;
let sort_by_ops_bar_and_status = params.sort_by_ops_bar_and_status;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/transitions", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
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) = expand {
local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = transition_id {
local_var_req_builder = local_var_req_builder.query(&[("transitionId", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = skip_remote_only_condition {
local_var_req_builder = local_var_req_builder.query(&[("skipRemoteOnlyCondition", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = include_unavailable_transitions {
local_var_req_builder = local_var_req_builder.query(&[("includeUnavailableTransitions", &local_var_str.to_string())]);
}
if let Some(ref local_var_str) = sort_by_ops_bar_and_status {
local_var_req_builder = local_var_req_builder.query(&[("sortByOpsBarAndStatus", &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<GetTransitionsSuccess> = 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<GetTransitionsError> = 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))
}
}
/// 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, params: NotifyParams) -> Result<ResponseContent<NotifySuccess>, Error<NotifyError>> {
let local_var_configuration = configuration;
// unbox the parameters
let issue_id_or_key = params.issue_id_or_key;
let request_body = params.request_body;
let local_var_client = &local_var_configuration.client;
let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/notify", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
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());
};
local_var_req_builder = local_var_req_builder.json(&request_body);
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<NotifySuccess> = 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<NotifyError> = 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))
}
}