jira_api_v2/apis/
issues_api.rs

1/*
2 * The Jira Cloud platform REST API
3 *
4 * Jira Cloud platform REST API documentation
5 *
6 * The version of the OpenAPI document: 1001.0.0-SNAPSHOT
7 * Contact: ecosystem@atlassian.com
8 * Generated by: https://openapi-generator.tech
9 */
10
11
12use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18/// struct for typed errors of method [`assign_issue`]
19#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum AssignIssueError {
22    Status400(),
23    Status403(),
24    Status404(),
25    UnknownValue(serde_json::Value),
26}
27
28/// struct for typed errors of method [`create_issue`]
29#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum CreateIssueError {
32    Status400(models::ErrorCollection),
33    Status401(models::ErrorCollection),
34    Status403(models::ErrorCollection),
35    UnknownValue(serde_json::Value),
36}
37
38/// struct for typed errors of method [`create_issues`]
39#[derive(Debug, Clone, Serialize, Deserialize)]
40#[serde(untagged)]
41pub enum CreateIssuesError {
42    Status400(models::CreatedIssues),
43    Status401(),
44    UnknownValue(serde_json::Value),
45}
46
47/// struct for typed errors of method [`delete_issue`]
48#[derive(Debug, Clone, Serialize, Deserialize)]
49#[serde(untagged)]
50pub enum DeleteIssueError {
51    Status400(),
52    Status401(),
53    Status403(),
54    Status404(),
55    UnknownValue(serde_json::Value),
56}
57
58/// struct for typed errors of method [`do_transition`]
59#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum DoTransitionError {
62    Status400(),
63    Status401(),
64    Status404(),
65    UnknownValue(serde_json::Value),
66}
67
68/// struct for typed errors of method [`edit_issue`]
69#[derive(Debug, Clone, Serialize, Deserialize)]
70#[serde(untagged)]
71pub enum EditIssueError {
72    Status400(),
73    Status401(),
74    Status403(),
75    Status404(),
76    UnknownValue(serde_json::Value),
77}
78
79/// struct for typed errors of method [`get_change_logs`]
80#[derive(Debug, Clone, Serialize, Deserialize)]
81#[serde(untagged)]
82pub enum GetChangeLogsError {
83    Status404(),
84    UnknownValue(serde_json::Value),
85}
86
87/// struct for typed errors of method [`get_create_issue_meta`]
88#[derive(Debug, Clone, Serialize, Deserialize)]
89#[serde(untagged)]
90pub enum GetCreateIssueMetaError {
91    Status401(),
92    UnknownValue(serde_json::Value),
93}
94
95/// struct for typed errors of method [`get_edit_issue_meta`]
96#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetEditIssueMetaError {
99    Status401(),
100    Status403(),
101    Status404(),
102    UnknownValue(serde_json::Value),
103}
104
105/// struct for typed errors of method [`get_issue`]
106#[derive(Debug, Clone, Serialize, Deserialize)]
107#[serde(untagged)]
108pub enum GetIssueError {
109    Status401(),
110    Status404(),
111    UnknownValue(serde_json::Value),
112}
113
114/// struct for typed errors of method [`get_transitions`]
115#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum GetTransitionsError {
118    Status401(),
119    Status404(),
120    UnknownValue(serde_json::Value),
121}
122
123/// struct for typed errors of method [`notify`]
124#[derive(Debug, Clone, Serialize, Deserialize)]
125#[serde(untagged)]
126pub enum NotifyError {
127    Status400(),
128    Status403(),
129    Status404(),
130    UnknownValue(serde_json::Value),
131}
132
133
134/// 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.
135pub async fn assign_issue(configuration: &configuration::Configuration, issue_id_or_key: &str, user: models::User) -> Result<serde_json::Value, Error<AssignIssueError>> {
136    // add a prefix to parameters to efficiently prevent name collisions
137    let p_issue_id_or_key = issue_id_or_key;
138    let p_user = user;
139
140    let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/assignee", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
141    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
142
143    if let Some(ref user_agent) = configuration.user_agent {
144        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
145    }
146    if let Some(ref token) = configuration.oauth_access_token {
147        req_builder = req_builder.bearer_auth(token.to_owned());
148    };
149    if let Some(ref auth_conf) = configuration.basic_auth {
150        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
151    };
152    req_builder = req_builder.json(&p_user);
153
154    let req = req_builder.build()?;
155    let resp = configuration.client.execute(req).await?;
156
157    let status = resp.status();
158
159    if !status.is_client_error() && !status.is_server_error() {
160        let content = resp.text().await?;
161        serde_json::from_str(&content).map_err(Error::from)
162    } else {
163        let content = resp.text().await?;
164        let entity: Option<AssignIssueError> = serde_json::from_str(&content).ok();
165        Err(Error::ResponseError(ResponseContent { status, content, entity }))
166    }
167}
168
169/// 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.
170pub async fn create_issue(configuration: &configuration::Configuration, issue_update_details: models::IssueUpdateDetails, update_history: Option<bool>) -> Result<models::CreatedIssue, Error<CreateIssueError>> {
171    // add a prefix to parameters to efficiently prevent name collisions
172    let p_issue_update_details = issue_update_details;
173    let p_update_history = update_history;
174
175    let uri_str = format!("{}/rest/api/2/issue", configuration.base_path);
176    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
177
178    if let Some(ref param_value) = p_update_history {
179        req_builder = req_builder.query(&[("updateHistory", &param_value.to_string())]);
180    }
181    if let Some(ref user_agent) = configuration.user_agent {
182        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
183    }
184    if let Some(ref token) = configuration.oauth_access_token {
185        req_builder = req_builder.bearer_auth(token.to_owned());
186    };
187    if let Some(ref auth_conf) = configuration.basic_auth {
188        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
189    };
190    req_builder = req_builder.json(&p_issue_update_details);
191
192    let req = req_builder.build()?;
193    let resp = configuration.client.execute(req).await?;
194
195    let status = resp.status();
196
197    if !status.is_client_error() && !status.is_server_error() {
198        let content = resp.text().await?;
199        serde_json::from_str(&content).map_err(Error::from)
200    } else {
201        let content = resp.text().await?;
202        let entity: Option<CreateIssueError> = serde_json::from_str(&content).ok();
203        Err(Error::ResponseError(ResponseContent { status, content, entity }))
204    }
205}
206
207/// 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.
208pub async fn create_issues(configuration: &configuration::Configuration, issues_update_bean: models::IssuesUpdateBean) -> Result<models::CreatedIssues, Error<CreateIssuesError>> {
209    // add a prefix to parameters to efficiently prevent name collisions
210    let p_issues_update_bean = issues_update_bean;
211
212    let uri_str = format!("{}/rest/api/2/issue/bulk", configuration.base_path);
213    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
214
215    if let Some(ref user_agent) = configuration.user_agent {
216        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
217    }
218    if let Some(ref token) = configuration.oauth_access_token {
219        req_builder = req_builder.bearer_auth(token.to_owned());
220    };
221    if let Some(ref auth_conf) = configuration.basic_auth {
222        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
223    };
224    req_builder = req_builder.json(&p_issues_update_bean);
225
226    let req = req_builder.build()?;
227    let resp = configuration.client.execute(req).await?;
228
229    let status = resp.status();
230
231    if !status.is_client_error() && !status.is_server_error() {
232        let content = resp.text().await?;
233        serde_json::from_str(&content).map_err(Error::from)
234    } else {
235        let content = resp.text().await?;
236        let entity: Option<CreateIssuesError> = serde_json::from_str(&content).ok();
237        Err(Error::ResponseError(ResponseContent { status, content, entity }))
238    }
239}
240
241/// 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.
242pub async fn delete_issue(configuration: &configuration::Configuration, issue_id_or_key: &str, delete_subtasks: Option<&str>) -> Result<(), Error<DeleteIssueError>> {
243    // add a prefix to parameters to efficiently prevent name collisions
244    let p_issue_id_or_key = issue_id_or_key;
245    let p_delete_subtasks = delete_subtasks;
246
247    let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
248    let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
249
250    if let Some(ref param_value) = p_delete_subtasks {
251        req_builder = req_builder.query(&[("deleteSubtasks", &param_value.to_string())]);
252    }
253    if let Some(ref user_agent) = configuration.user_agent {
254        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
255    }
256    if let Some(ref token) = configuration.oauth_access_token {
257        req_builder = req_builder.bearer_auth(token.to_owned());
258    };
259    if let Some(ref auth_conf) = configuration.basic_auth {
260        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
261    };
262
263    let req = req_builder.build()?;
264    let resp = configuration.client.execute(req).await?;
265
266    let status = resp.status();
267
268    if !status.is_client_error() && !status.is_server_error() {
269        Ok(())
270    } else {
271        let content = resp.text().await?;
272        let entity: Option<DeleteIssueError> = serde_json::from_str(&content).ok();
273        Err(Error::ResponseError(ResponseContent { status, content, entity }))
274    }
275}
276
277/// 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.
278pub async fn do_transition(configuration: &configuration::Configuration, issue_id_or_key: &str, issue_update_details: models::IssueUpdateDetails) -> Result<serde_json::Value, Error<DoTransitionError>> {
279    // add a prefix to parameters to efficiently prevent name collisions
280    let p_issue_id_or_key = issue_id_or_key;
281    let p_issue_update_details = issue_update_details;
282
283    let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/transitions", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
284    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
285
286    if let Some(ref user_agent) = configuration.user_agent {
287        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
288    }
289    if let Some(ref token) = configuration.oauth_access_token {
290        req_builder = req_builder.bearer_auth(token.to_owned());
291    };
292    if let Some(ref auth_conf) = configuration.basic_auth {
293        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
294    };
295    req_builder = req_builder.json(&p_issue_update_details);
296
297    let req = req_builder.build()?;
298    let resp = configuration.client.execute(req).await?;
299
300    let status = resp.status();
301
302    if !status.is_client_error() && !status.is_server_error() {
303        let content = resp.text().await?;
304        serde_json::from_str(&content).map_err(Error::from)
305    } else {
306        let content = resp.text().await?;
307        let entity: Option<DoTransitionError> = serde_json::from_str(&content).ok();
308        Err(Error::ResponseError(ResponseContent { status, content, entity }))
309    }
310}
311
312/// 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.
313pub 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>> {
314    // add a prefix to parameters to efficiently prevent name collisions
315    let p_issue_id_or_key = issue_id_or_key;
316    let p_issue_update_details = issue_update_details;
317    let p_notify_users = notify_users;
318    let p_override_screen_security = override_screen_security;
319    let p_override_editable_flag = override_editable_flag;
320
321    let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
322    let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
323
324    if let Some(ref param_value) = p_notify_users {
325        req_builder = req_builder.query(&[("notifyUsers", &param_value.to_string())]);
326    }
327    if let Some(ref param_value) = p_override_screen_security {
328        req_builder = req_builder.query(&[("overrideScreenSecurity", &param_value.to_string())]);
329    }
330    if let Some(ref param_value) = p_override_editable_flag {
331        req_builder = req_builder.query(&[("overrideEditableFlag", &param_value.to_string())]);
332    }
333    if let Some(ref user_agent) = configuration.user_agent {
334        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
335    }
336    if let Some(ref token) = configuration.oauth_access_token {
337        req_builder = req_builder.bearer_auth(token.to_owned());
338    };
339    if let Some(ref auth_conf) = configuration.basic_auth {
340        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
341    };
342    req_builder = req_builder.json(&p_issue_update_details);
343
344    let req = req_builder.build()?;
345    let resp = configuration.client.execute(req).await?;
346
347    let status = resp.status();
348
349    if !status.is_client_error() && !status.is_server_error() {
350        let content = resp.text().await?;
351        serde_json::from_str(&content).map_err(Error::from)
352    } else {
353        let content = resp.text().await?;
354        let entity: Option<EditIssueError> = serde_json::from_str(&content).ok();
355        Err(Error::ResponseError(ResponseContent { status, content, entity }))
356    }
357}
358
359/// 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.
360pub 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>> {
361    // add a prefix to parameters to efficiently prevent name collisions
362    let p_issue_id_or_key = issue_id_or_key;
363    let p_start_at = start_at;
364    let p_max_results = max_results;
365
366    let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/changelog", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
367    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
368
369    if let Some(ref param_value) = p_start_at {
370        req_builder = req_builder.query(&[("startAt", &param_value.to_string())]);
371    }
372    if let Some(ref param_value) = p_max_results {
373        req_builder = req_builder.query(&[("maxResults", &param_value.to_string())]);
374    }
375    if let Some(ref user_agent) = configuration.user_agent {
376        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
377    }
378    if let Some(ref token) = configuration.oauth_access_token {
379        req_builder = req_builder.bearer_auth(token.to_owned());
380    };
381    if let Some(ref auth_conf) = configuration.basic_auth {
382        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
383    };
384
385    let req = req_builder.build()?;
386    let resp = configuration.client.execute(req).await?;
387
388    let status = resp.status();
389
390    if !status.is_client_error() && !status.is_server_error() {
391        let content = resp.text().await?;
392        serde_json::from_str(&content).map_err(Error::from)
393    } else {
394        let content = resp.text().await?;
395        let entity: Option<GetChangeLogsError> = serde_json::from_str(&content).ok();
396        Err(Error::ResponseError(ResponseContent { status, content, entity }))
397    }
398}
399
400/// 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.
401pub 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>> {
402    // add a prefix to parameters to efficiently prevent name collisions
403    let p_project_ids = project_ids;
404    let p_project_keys = project_keys;
405    let p_issuetype_ids = issuetype_ids;
406    let p_issuetype_names = issuetype_names;
407    let p_expand = expand;
408
409    let uri_str = format!("{}/rest/api/2/issue/createmeta", configuration.base_path);
410    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
411
412    if let Some(ref param_value) = p_project_ids {
413        req_builder = match "multi" {
414            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("projectIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
415            _ => req_builder.query(&[("projectIds", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
416        };
417    }
418    if let Some(ref param_value) = p_project_keys {
419        req_builder = match "multi" {
420            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("projectKeys".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
421            _ => req_builder.query(&[("projectKeys", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
422        };
423    }
424    if let Some(ref param_value) = p_issuetype_ids {
425        req_builder = match "multi" {
426            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("issuetypeIds".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
427            _ => req_builder.query(&[("issuetypeIds", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
428        };
429    }
430    if let Some(ref param_value) = p_issuetype_names {
431        req_builder = match "multi" {
432            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("issuetypeNames".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
433            _ => req_builder.query(&[("issuetypeNames", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
434        };
435    }
436    if let Some(ref param_value) = p_expand {
437        req_builder = req_builder.query(&[("expand", &param_value.to_string())]);
438    }
439    if let Some(ref user_agent) = configuration.user_agent {
440        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
441    }
442    if let Some(ref token) = configuration.oauth_access_token {
443        req_builder = req_builder.bearer_auth(token.to_owned());
444    };
445    if let Some(ref auth_conf) = configuration.basic_auth {
446        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
447    };
448
449    let req = req_builder.build()?;
450    let resp = configuration.client.execute(req).await?;
451
452    let status = resp.status();
453
454    if !status.is_client_error() && !status.is_server_error() {
455        let content = resp.text().await?;
456        serde_json::from_str(&content).map_err(Error::from)
457    } else {
458        let content = resp.text().await?;
459        let entity: Option<GetCreateIssueMetaError> = serde_json::from_str(&content).ok();
460        Err(Error::ResponseError(ResponseContent { status, content, entity }))
461    }
462}
463
464/// 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.
465pub 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>> {
466    // add a prefix to parameters to efficiently prevent name collisions
467    let p_issue_id_or_key = issue_id_or_key;
468    let p_override_screen_security = override_screen_security;
469    let p_override_editable_flag = override_editable_flag;
470
471    let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/editmeta", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
472    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
473
474    if let Some(ref param_value) = p_override_screen_security {
475        req_builder = req_builder.query(&[("overrideScreenSecurity", &param_value.to_string())]);
476    }
477    if let Some(ref param_value) = p_override_editable_flag {
478        req_builder = req_builder.query(&[("overrideEditableFlag", &param_value.to_string())]);
479    }
480    if let Some(ref user_agent) = configuration.user_agent {
481        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
482    }
483    if let Some(ref token) = configuration.oauth_access_token {
484        req_builder = req_builder.bearer_auth(token.to_owned());
485    };
486    if let Some(ref auth_conf) = configuration.basic_auth {
487        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
488    };
489
490    let req = req_builder.build()?;
491    let resp = configuration.client.execute(req).await?;
492
493    let status = resp.status();
494
495    if !status.is_client_error() && !status.is_server_error() {
496        let content = resp.text().await?;
497        serde_json::from_str(&content).map_err(Error::from)
498    } else {
499        let content = resp.text().await?;
500        let entity: Option<GetEditIssueMetaError> = serde_json::from_str(&content).ok();
501        Err(Error::ResponseError(ResponseContent { status, content, entity }))
502    }
503}
504
505/// 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.
506pub 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>> {
507    // add a prefix to parameters to efficiently prevent name collisions
508    let p_issue_id_or_key = issue_id_or_key;
509    let p_fields = fields;
510    let p_fields_by_keys = fields_by_keys;
511    let p_expand = expand;
512    let p_properties = properties;
513    let p_update_history = update_history;
514
515    let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
516    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
517
518    if let Some(ref param_value) = p_fields {
519        req_builder = match "multi" {
520            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("fields".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
521            _ => req_builder.query(&[("fields", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
522        };
523    }
524    if let Some(ref param_value) = p_fields_by_keys {
525        req_builder = req_builder.query(&[("fieldsByKeys", &param_value.to_string())]);
526    }
527    if let Some(ref param_value) = p_expand {
528        req_builder = req_builder.query(&[("expand", &param_value.to_string())]);
529    }
530    if let Some(ref param_value) = p_properties {
531        req_builder = match "multi" {
532            "multi" => req_builder.query(&param_value.into_iter().map(|p| ("properties".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
533            _ => req_builder.query(&[("properties", &param_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
534        };
535    }
536    if let Some(ref param_value) = p_update_history {
537        req_builder = req_builder.query(&[("updateHistory", &param_value.to_string())]);
538    }
539    if let Some(ref user_agent) = configuration.user_agent {
540        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
541    }
542    if let Some(ref token) = configuration.oauth_access_token {
543        req_builder = req_builder.bearer_auth(token.to_owned());
544    };
545    if let Some(ref auth_conf) = configuration.basic_auth {
546        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
547    };
548
549    let req = req_builder.build()?;
550    let resp = configuration.client.execute(req).await?;
551
552    let status = resp.status();
553
554    if !status.is_client_error() && !status.is_server_error() {
555        let content = resp.text().await?;
556        serde_json::from_str(&content).map_err(Error::from)
557    } else {
558        let content = resp.text().await?;
559        let entity: Option<GetIssueError> = serde_json::from_str(&content).ok();
560        Err(Error::ResponseError(ResponseContent { status, content, entity }))
561    }
562}
563
564/// 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.
565pub 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>> {
566    // add a prefix to parameters to efficiently prevent name collisions
567    let p_issue_id_or_key = issue_id_or_key;
568    let p_expand = expand;
569    let p_transition_id = transition_id;
570    let p_skip_remote_only_condition = skip_remote_only_condition;
571    let p_include_unavailable_transitions = include_unavailable_transitions;
572    let p_sort_by_ops_bar_and_status = sort_by_ops_bar_and_status;
573
574    let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/transitions", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
575    let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
576
577    if let Some(ref param_value) = p_expand {
578        req_builder = req_builder.query(&[("expand", &param_value.to_string())]);
579    }
580    if let Some(ref param_value) = p_transition_id {
581        req_builder = req_builder.query(&[("transitionId", &param_value.to_string())]);
582    }
583    if let Some(ref param_value) = p_skip_remote_only_condition {
584        req_builder = req_builder.query(&[("skipRemoteOnlyCondition", &param_value.to_string())]);
585    }
586    if let Some(ref param_value) = p_include_unavailable_transitions {
587        req_builder = req_builder.query(&[("includeUnavailableTransitions", &param_value.to_string())]);
588    }
589    if let Some(ref param_value) = p_sort_by_ops_bar_and_status {
590        req_builder = req_builder.query(&[("sortByOpsBarAndStatus", &param_value.to_string())]);
591    }
592    if let Some(ref user_agent) = configuration.user_agent {
593        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
594    }
595    if let Some(ref token) = configuration.oauth_access_token {
596        req_builder = req_builder.bearer_auth(token.to_owned());
597    };
598    if let Some(ref auth_conf) = configuration.basic_auth {
599        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
600    };
601
602    let req = req_builder.build()?;
603    let resp = configuration.client.execute(req).await?;
604
605    let status = resp.status();
606
607    if !status.is_client_error() && !status.is_server_error() {
608        let content = resp.text().await?;
609        serde_json::from_str(&content).map_err(Error::from)
610    } else {
611        let content = resp.text().await?;
612        let entity: Option<GetTransitionsError> = serde_json::from_str(&content).ok();
613        Err(Error::ResponseError(ResponseContent { status, content, entity }))
614    }
615}
616
617/// 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.
618pub async fn notify(configuration: &configuration::Configuration, issue_id_or_key: &str, notification: models::Notification) -> Result<serde_json::Value, Error<NotifyError>> {
619    // add a prefix to parameters to efficiently prevent name collisions
620    let p_issue_id_or_key = issue_id_or_key;
621    let p_notification = notification;
622
623    let uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}/notify", configuration.base_path, issueIdOrKey=crate::apis::urlencode(p_issue_id_or_key));
624    let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
625
626    if let Some(ref user_agent) = configuration.user_agent {
627        req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
628    }
629    if let Some(ref token) = configuration.oauth_access_token {
630        req_builder = req_builder.bearer_auth(token.to_owned());
631    };
632    if let Some(ref auth_conf) = configuration.basic_auth {
633        req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
634    };
635    req_builder = req_builder.json(&p_notification);
636
637    let req = req_builder.build()?;
638    let resp = configuration.client.execute(req).await?;
639
640    let status = resp.status();
641
642    if !status.is_client_error() && !status.is_server_error() {
643        let content = resp.text().await?;
644        serde_json::from_str(&content).map_err(Error::from)
645    } else {
646        let content = resp.text().await?;
647        let entity: Option<NotifyError> = serde_json::from_str(&content).ok();
648        Err(Error::ResponseError(ResponseContent { status, content, entity }))
649    }
650}
651