hi_jira2/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;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17/// struct for passing parameters to the method [`assign_issue`]
18#[derive(Clone, Debug, Default)]
19pub struct AssignIssueParams {
20    /// The ID or key of the issue to be assigned.
21    pub issue_id_or_key: String,
22    /// The request object with the user that the issue is assigned to.
23    pub user: crate::models::User
24}
25
26/// struct for passing parameters to the method [`create_issue`]
27#[derive(Clone, Debug, Default)]
28pub struct CreateIssueParams {
29    pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
30    /// 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.
31    pub update_history: Option<bool>
32}
33
34/// struct for passing parameters to the method [`create_issues`]
35#[derive(Clone, Debug, Default)]
36pub struct CreateIssuesParams {
37    pub request_body: ::std::collections::HashMap<String, serde_json::Value>
38}
39
40/// struct for passing parameters to the method [`delete_issue`]
41#[derive(Clone, Debug, Default)]
42pub struct DeleteIssueParams {
43    /// The ID or key of the issue.
44    pub issue_id_or_key: String,
45    /// Whether the issue's subtasks are deleted when the issue is deleted.
46    pub delete_subtasks: Option<String>
47}
48
49/// struct for passing parameters to the method [`do_transition`]
50#[derive(Clone, Debug, Default)]
51pub struct DoTransitionParams {
52    /// The ID or key of the issue.
53    pub issue_id_or_key: String,
54    pub request_body: ::std::collections::HashMap<String, serde_json::Value>
55}
56
57/// struct for passing parameters to the method [`edit_issue`]
58#[derive(Clone, Debug, Default)]
59pub struct EditIssueParams {
60    /// The ID or key of the issue.
61    pub issue_id_or_key: String,
62    pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
63    /// 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.
64    pub notify_users: Option<bool>,
65    /// 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).
66    pub override_screen_security: Option<bool>,
67    /// 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).
68    pub override_editable_flag: Option<bool>
69}
70
71/// struct for passing parameters to the method [`get_change_logs`]
72#[derive(Clone, Debug, Default)]
73pub struct GetChangeLogsParams {
74    /// The ID or key of the issue.
75    pub issue_id_or_key: String,
76    /// The index of the first item to return in a page of results (page offset).
77    pub start_at: Option<i32>,
78    /// The maximum number of items to return per page.
79    pub max_results: Option<i32>
80}
81
82/// struct for passing parameters to the method [`get_change_logs_by_ids`]
83#[derive(Clone, Debug, Default)]
84pub struct GetChangeLogsByIdsParams {
85    /// The ID or key of the issue.
86    pub issue_id_or_key: String,
87    pub issue_changelog_ids: crate::models::IssueChangelogIds
88}
89
90/// struct for passing parameters to the method [`get_create_issue_meta`]
91#[derive(Clone, Debug, Default)]
92pub struct GetCreateIssueMetaParams {
93    /// 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`.
94    pub project_ids: Option<Vec<String>>,
95    /// 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`.
96    pub project_keys: Option<Vec<String>>,
97    /// 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`.
98    pub issuetype_ids: Option<Vec<String>>,
99    /// 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`.
100    pub issuetype_names: Option<Vec<String>>,
101    /// 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).
102    pub expand: Option<String>
103}
104
105/// struct for passing parameters to the method [`get_edit_issue_meta`]
106#[derive(Clone, Debug, Default)]
107pub struct GetEditIssueMetaParams {
108    /// The ID or key of the issue.
109    pub issue_id_or_key: String,
110    /// 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).
111    pub override_screen_security: Option<bool>,
112    /// 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).
113    pub override_editable_flag: Option<bool>
114}
115
116/// struct for passing parameters to the method [`get_issue`]
117#[derive(Clone, Debug, Default)]
118pub struct GetIssueParams {
119    /// The ID or key of the issue.
120    pub issue_id_or_key: String,
121    /// 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.
122    pub fields: Option<Vec<String>>,
123    /// 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.
124    pub fields_by_keys: Option<bool>,
125    /// 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.
126    pub expand: Option<String>,
127    /// 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`.
128    pub properties: Option<Vec<String>>,
129    /// 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.
130    pub update_history: Option<bool>
131}
132
133/// struct for passing parameters to the method [`get_transitions`]
134#[derive(Clone, Debug, Default)]
135pub struct GetTransitionsParams {
136    /// The ID or key of the issue.
137    pub issue_id_or_key: String,
138    /// 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).
139    pub expand: Option<String>,
140    /// The ID of the transition.
141    pub transition_id: Option<String>,
142    /// Whether transitions with the condition *Hide From User Condition* are included in the response.
143    pub skip_remote_only_condition: Option<bool>,
144    /// Whether details of transitions that fail a condition are included in the response
145    pub include_unavailable_transitions: Option<bool>,
146    /// 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.
147    pub sort_by_ops_bar_and_status: Option<bool>
148}
149
150/// struct for passing parameters to the method [`notify`]
151#[derive(Clone, Debug, Default)]
152pub struct NotifyParams {
153    /// ID or key of the issue that the notification is sent for.
154    pub issue_id_or_key: String,
155    /// The request object for the notification and recipients.
156    pub request_body: ::std::collections::HashMap<String, serde_json::Value>
157}
158
159
160/// struct for typed errors of method [`assign_issue`]
161#[derive(Debug, Clone, Serialize, Deserialize)]
162#[serde(untagged)]
163pub enum AssignIssueError {
164    Status400(),
165    Status403(),
166    Status404(),
167    UnknownValue(serde_json::Value),
168}
169
170/// struct for typed errors of method [`create_issue`]
171#[derive(Debug, Clone, Serialize, Deserialize)]
172#[serde(untagged)]
173pub enum CreateIssueError {
174    Status400(crate::models::ErrorCollection),
175    Status401(crate::models::ErrorCollection),
176    Status403(crate::models::ErrorCollection),
177    UnknownValue(serde_json::Value),
178}
179
180/// struct for typed errors of method [`create_issues`]
181#[derive(Debug, Clone, Serialize, Deserialize)]
182#[serde(untagged)]
183pub enum CreateIssuesError {
184    Status400(crate::models::CreatedIssues),
185    Status401(),
186    UnknownValue(serde_json::Value),
187}
188
189/// struct for typed errors of method [`delete_issue`]
190#[derive(Debug, Clone, Serialize, Deserialize)]
191#[serde(untagged)]
192pub enum DeleteIssueError {
193    Status400(),
194    Status401(),
195    Status403(),
196    Status404(),
197    UnknownValue(serde_json::Value),
198}
199
200/// struct for typed errors of method [`do_transition`]
201#[derive(Debug, Clone, Serialize, Deserialize)]
202#[serde(untagged)]
203pub enum DoTransitionError {
204    Status400(),
205    Status401(),
206    Status404(),
207    UnknownValue(serde_json::Value),
208}
209
210/// struct for typed errors of method [`edit_issue`]
211#[derive(Debug, Clone, Serialize, Deserialize)]
212#[serde(untagged)]
213pub enum EditIssueError {
214    Status400(),
215    Status401(),
216    Status403(),
217    Status404(),
218    UnknownValue(serde_json::Value),
219}
220
221/// struct for typed errors of method [`get_change_logs`]
222#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum GetChangeLogsError {
225    Status404(),
226    UnknownValue(serde_json::Value),
227}
228
229/// struct for typed errors of method [`get_change_logs_by_ids`]
230#[derive(Debug, Clone, Serialize, Deserialize)]
231#[serde(untagged)]
232pub enum GetChangeLogsByIdsError {
233    Status400(),
234    Status404(),
235    UnknownValue(serde_json::Value),
236}
237
238/// struct for typed errors of method [`get_create_issue_meta`]
239#[derive(Debug, Clone, Serialize, Deserialize)]
240#[serde(untagged)]
241pub enum GetCreateIssueMetaError {
242    Status401(),
243    UnknownValue(serde_json::Value),
244}
245
246/// struct for typed errors of method [`get_edit_issue_meta`]
247#[derive(Debug, Clone, Serialize, Deserialize)]
248#[serde(untagged)]
249pub enum GetEditIssueMetaError {
250    Status401(),
251    Status403(),
252    Status404(),
253    UnknownValue(serde_json::Value),
254}
255
256/// struct for typed errors of method [`get_events`]
257#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum GetEventsError {
260    Status401(),
261    Status403(),
262    UnknownValue(serde_json::Value),
263}
264
265/// struct for typed errors of method [`get_issue`]
266#[derive(Debug, Clone, Serialize, Deserialize)]
267#[serde(untagged)]
268pub enum GetIssueError {
269    Status401(),
270    Status404(),
271    UnknownValue(serde_json::Value),
272}
273
274/// struct for typed errors of method [`get_transitions`]
275#[derive(Debug, Clone, Serialize, Deserialize)]
276#[serde(untagged)]
277pub enum GetTransitionsError {
278    Status401(),
279    Status404(),
280    UnknownValue(serde_json::Value),
281}
282
283/// struct for typed errors of method [`notify`]
284#[derive(Debug, Clone, Serialize, Deserialize)]
285#[serde(untagged)]
286pub enum NotifyError {
287    Status400(),
288    Status403(),
289    Status404(),
290    UnknownValue(serde_json::Value),
291}
292
293
294/// 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.
295pub async fn assign_issue(configuration: &configuration::Configuration, params: AssignIssueParams) -> Result<serde_json::Value, Error<AssignIssueError>> {
296    let local_var_configuration = configuration;
297
298    // unbox the parameters
299    let issue_id_or_key = params.issue_id_or_key;
300    let user = params.user;
301
302
303    let local_var_client = &local_var_configuration.client;
304
305    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));
306    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
307
308    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
309        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
310    }
311    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
312        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
313    };
314    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
315        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
316    };
317    local_var_req_builder = local_var_req_builder.json(&user);
318
319    let local_var_req = local_var_req_builder.build()?;
320    let local_var_resp = local_var_client.execute(local_var_req).await?;
321
322    let local_var_status = local_var_resp.status();
323    let local_var_content = local_var_resp.text().await?;
324
325    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
326        serde_json::from_str(&local_var_content).map_err(Error::from)
327    } else {
328        let local_var_entity: Option<AssignIssueError> = serde_json::from_str(&local_var_content).ok();
329        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
330        Err(Error::ResponseError(local_var_error))
331    }
332}
333
334/// 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.
335pub async fn create_issue(configuration: &configuration::Configuration, params: CreateIssueParams) -> Result<crate::models::CreatedIssue, Error<CreateIssueError>> {
336    let local_var_configuration = configuration;
337
338    // unbox the parameters
339    let request_body = params.request_body;
340    let update_history = params.update_history;
341
342
343    let local_var_client = &local_var_configuration.client;
344
345    let local_var_uri_str = format!("{}/rest/api/2/issue", local_var_configuration.base_path);
346    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
347
348    if let Some(ref local_var_str) = update_history {
349        local_var_req_builder = local_var_req_builder.query(&[("updateHistory", &local_var_str.to_string())]);
350    }
351    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
352        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
353    }
354    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
355        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
356    };
357    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
358        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
359    };
360    local_var_req_builder = local_var_req_builder.json(&request_body);
361
362    let local_var_req = local_var_req_builder.build()?;
363    let local_var_resp = local_var_client.execute(local_var_req).await?;
364
365    let local_var_status = local_var_resp.status();
366    let local_var_content = local_var_resp.text().await?;
367
368    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
369        serde_json::from_str(&local_var_content).map_err(Error::from)
370    } else {
371        let local_var_entity: Option<CreateIssueError> = serde_json::from_str(&local_var_content).ok();
372        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
373        Err(Error::ResponseError(local_var_error))
374    }
375}
376
377/// 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.
378pub async fn create_issues(configuration: &configuration::Configuration, params: CreateIssuesParams) -> Result<crate::models::CreatedIssues, Error<CreateIssuesError>> {
379    let local_var_configuration = configuration;
380
381    // unbox the parameters
382    let request_body = params.request_body;
383
384
385    let local_var_client = &local_var_configuration.client;
386
387    let local_var_uri_str = format!("{}/rest/api/2/issue/bulk", local_var_configuration.base_path);
388    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
389
390    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
391        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
392    }
393    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
394        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
395    };
396    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
397        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
398    };
399    local_var_req_builder = local_var_req_builder.json(&request_body);
400
401    let local_var_req = local_var_req_builder.build()?;
402    let local_var_resp = local_var_client.execute(local_var_req).await?;
403
404    let local_var_status = local_var_resp.status();
405    let local_var_content = local_var_resp.text().await?;
406
407    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
408        serde_json::from_str(&local_var_content).map_err(Error::from)
409    } else {
410        let local_var_entity: Option<CreateIssuesError> = serde_json::from_str(&local_var_content).ok();
411        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
412        Err(Error::ResponseError(local_var_error))
413    }
414}
415
416/// 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.
417pub async fn delete_issue(configuration: &configuration::Configuration, params: DeleteIssueParams) -> Result<(), Error<DeleteIssueError>> {
418    let local_var_configuration = configuration;
419
420    // unbox the parameters
421    let issue_id_or_key = params.issue_id_or_key;
422    let delete_subtasks = params.delete_subtasks;
423
424
425    let local_var_client = &local_var_configuration.client;
426
427    let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
428    let mut local_var_req_builder = local_var_client.request(reqwest::Method::DELETE, local_var_uri_str.as_str());
429
430    if let Some(ref local_var_str) = delete_subtasks {
431        local_var_req_builder = local_var_req_builder.query(&[("deleteSubtasks", &local_var_str.to_string())]);
432    }
433    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
434        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
435    }
436    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
437        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
438    };
439    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
440        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
441    };
442
443    let local_var_req = local_var_req_builder.build()?;
444    let local_var_resp = local_var_client.execute(local_var_req).await?;
445
446    let local_var_status = local_var_resp.status();
447    let local_var_content = local_var_resp.text().await?;
448
449    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
450        Ok(())
451    } else {
452        let local_var_entity: Option<DeleteIssueError> = serde_json::from_str(&local_var_content).ok();
453        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
454        Err(Error::ResponseError(local_var_error))
455    }
456}
457
458/// 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.
459pub async fn do_transition(configuration: &configuration::Configuration, params: DoTransitionParams) -> Result<serde_json::Value, Error<DoTransitionError>> {
460    let local_var_configuration = configuration;
461
462    // unbox the parameters
463    let issue_id_or_key = params.issue_id_or_key;
464    let request_body = params.request_body;
465
466
467    let local_var_client = &local_var_configuration.client;
468
469    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));
470    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
471
472    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
473        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
474    }
475    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
476        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
477    };
478    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
479        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
480    };
481    local_var_req_builder = local_var_req_builder.json(&request_body);
482
483    let local_var_req = local_var_req_builder.build()?;
484    let local_var_resp = local_var_client.execute(local_var_req).await?;
485
486    let local_var_status = local_var_resp.status();
487    let local_var_content = local_var_resp.text().await?;
488
489    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
490        serde_json::from_str(&local_var_content).map_err(Error::from)
491    } else {
492        let local_var_entity: Option<DoTransitionError> = serde_json::from_str(&local_var_content).ok();
493        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
494        Err(Error::ResponseError(local_var_error))
495    }
496}
497
498/// 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.
499pub async fn edit_issue(configuration: &configuration::Configuration, params: EditIssueParams) -> Result<serde_json::Value, Error<EditIssueError>> {
500    let local_var_configuration = configuration;
501
502    // unbox the parameters
503    let issue_id_or_key = params.issue_id_or_key;
504    let request_body = params.request_body;
505    let notify_users = params.notify_users;
506    let override_screen_security = params.override_screen_security;
507    let override_editable_flag = params.override_editable_flag;
508
509
510    let local_var_client = &local_var_configuration.client;
511
512    let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
513    let mut local_var_req_builder = local_var_client.request(reqwest::Method::PUT, local_var_uri_str.as_str());
514
515    if let Some(ref local_var_str) = notify_users {
516        local_var_req_builder = local_var_req_builder.query(&[("notifyUsers", &local_var_str.to_string())]);
517    }
518    if let Some(ref local_var_str) = override_screen_security {
519        local_var_req_builder = local_var_req_builder.query(&[("overrideScreenSecurity", &local_var_str.to_string())]);
520    }
521    if let Some(ref local_var_str) = override_editable_flag {
522        local_var_req_builder = local_var_req_builder.query(&[("overrideEditableFlag", &local_var_str.to_string())]);
523    }
524    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
525        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
526    }
527    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
528        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
529    };
530    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
531        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
532    };
533    local_var_req_builder = local_var_req_builder.json(&request_body);
534
535    let local_var_req = local_var_req_builder.build()?;
536    let local_var_resp = local_var_client.execute(local_var_req).await?;
537
538    let local_var_status = local_var_resp.status();
539    let local_var_content = local_var_resp.text().await?;
540
541    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
542        serde_json::from_str(&local_var_content).map_err(Error::from)
543    } else {
544        let local_var_entity: Option<EditIssueError> = serde_json::from_str(&local_var_content).ok();
545        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
546        Err(Error::ResponseError(local_var_error))
547    }
548}
549
550/// 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.
551pub async fn get_change_logs(configuration: &configuration::Configuration, params: GetChangeLogsParams) -> Result<crate::models::PageBeanChangelog, Error<GetChangeLogsError>> {
552    let local_var_configuration = configuration;
553
554    // unbox the parameters
555    let issue_id_or_key = params.issue_id_or_key;
556    let start_at = params.start_at;
557    let max_results = params.max_results;
558
559
560    let local_var_client = &local_var_configuration.client;
561
562    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));
563    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
564
565    if let Some(ref local_var_str) = start_at {
566        local_var_req_builder = local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
567    }
568    if let Some(ref local_var_str) = max_results {
569        local_var_req_builder = local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
570    }
571    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
572        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
573    }
574    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
575        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
576    };
577    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
578        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
579    };
580
581    let local_var_req = local_var_req_builder.build()?;
582    let local_var_resp = local_var_client.execute(local_var_req).await?;
583
584    let local_var_status = local_var_resp.status();
585    let local_var_content = local_var_resp.text().await?;
586
587    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
588        serde_json::from_str(&local_var_content).map_err(Error::from)
589    } else {
590        let local_var_entity: Option<GetChangeLogsError> = serde_json::from_str(&local_var_content).ok();
591        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
592        Err(Error::ResponseError(local_var_error))
593    }
594}
595
596/// Returns 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.
597pub async fn get_change_logs_by_ids(configuration: &configuration::Configuration, params: GetChangeLogsByIdsParams) -> Result<crate::models::PageOfChangelogs, Error<GetChangeLogsByIdsError>> {
598    let local_var_configuration = configuration;
599
600    // unbox the parameters
601    let issue_id_or_key = params.issue_id_or_key;
602    let issue_changelog_ids = params.issue_changelog_ids;
603
604
605    let local_var_client = &local_var_configuration.client;
606
607    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));
608    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
609
610    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
611        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
612    }
613    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
614        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
615    };
616    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
617        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
618    };
619    local_var_req_builder = local_var_req_builder.json(&issue_changelog_ids);
620
621    let local_var_req = local_var_req_builder.build()?;
622    let local_var_resp = local_var_client.execute(local_var_req).await?;
623
624    let local_var_status = local_var_resp.status();
625    let local_var_content = local_var_resp.text().await?;
626
627    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
628        serde_json::from_str(&local_var_content).map_err(Error::from)
629    } else {
630        let local_var_entity: Option<GetChangeLogsByIdsError> = serde_json::from_str(&local_var_content).ok();
631        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
632        Err(Error::ResponseError(local_var_error))
633    }
634}
635
636/// 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.
637pub async fn get_create_issue_meta(configuration: &configuration::Configuration, params: GetCreateIssueMetaParams) -> Result<crate::models::IssueCreateMetadata, Error<GetCreateIssueMetaError>> {
638    let local_var_configuration = configuration;
639
640    // unbox the parameters
641    let project_ids = params.project_ids;
642    let project_keys = params.project_keys;
643    let issuetype_ids = params.issuetype_ids;
644    let issuetype_names = params.issuetype_names;
645    let expand = params.expand;
646
647
648    let local_var_client = &local_var_configuration.client;
649
650    let local_var_uri_str = format!("{}/rest/api/2/issue/createmeta", local_var_configuration.base_path);
651    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
652
653    if let Some(ref local_var_str) = project_ids {
654        local_var_req_builder = match "multi" {
655            "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)>>()),
656            _ => local_var_req_builder.query(&[("projectIds", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
657        };
658    }
659    if let Some(ref local_var_str) = project_keys {
660        local_var_req_builder = match "multi" {
661            "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)>>()),
662            _ => local_var_req_builder.query(&[("projectKeys", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
663        };
664    }
665    if let Some(ref local_var_str) = issuetype_ids {
666        local_var_req_builder = match "multi" {
667            "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)>>()),
668            _ => local_var_req_builder.query(&[("issuetypeIds", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
669        };
670    }
671    if let Some(ref local_var_str) = issuetype_names {
672        local_var_req_builder = match "multi" {
673            "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)>>()),
674            _ => local_var_req_builder.query(&[("issuetypeNames", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
675        };
676    }
677    if let Some(ref local_var_str) = expand {
678        local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
679    }
680    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
681        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
682    }
683    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
684        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
685    };
686    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
687        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
688    };
689
690    let local_var_req = local_var_req_builder.build()?;
691    let local_var_resp = local_var_client.execute(local_var_req).await?;
692
693    let local_var_status = local_var_resp.status();
694    let local_var_content = local_var_resp.text().await?;
695
696    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
697        serde_json::from_str(&local_var_content).map_err(Error::from)
698    } else {
699        let local_var_entity: Option<GetCreateIssueMetaError> = serde_json::from_str(&local_var_content).ok();
700        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
701        Err(Error::ResponseError(local_var_error))
702    }
703}
704
705/// 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.
706pub async fn get_edit_issue_meta(configuration: &configuration::Configuration, params: GetEditIssueMetaParams) -> Result<crate::models::IssueUpdateMetadata, Error<GetEditIssueMetaError>> {
707    let local_var_configuration = configuration;
708
709    // unbox the parameters
710    let issue_id_or_key = params.issue_id_or_key;
711    let override_screen_security = params.override_screen_security;
712    let override_editable_flag = params.override_editable_flag;
713
714
715    let local_var_client = &local_var_configuration.client;
716
717    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));
718    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
719
720    if let Some(ref local_var_str) = override_screen_security {
721        local_var_req_builder = local_var_req_builder.query(&[("overrideScreenSecurity", &local_var_str.to_string())]);
722    }
723    if let Some(ref local_var_str) = override_editable_flag {
724        local_var_req_builder = local_var_req_builder.query(&[("overrideEditableFlag", &local_var_str.to_string())]);
725    }
726    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
727        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
728    }
729    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
730        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
731    };
732    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
733        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
734    };
735
736    let local_var_req = local_var_req_builder.build()?;
737    let local_var_resp = local_var_client.execute(local_var_req).await?;
738
739    let local_var_status = local_var_resp.status();
740    let local_var_content = local_var_resp.text().await?;
741
742    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
743        serde_json::from_str(&local_var_content).map_err(Error::from)
744    } else {
745        let local_var_entity: Option<GetEditIssueMetaError> = serde_json::from_str(&local_var_content).ok();
746        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
747        Err(Error::ResponseError(local_var_error))
748    }
749}
750
751/// Returns all issue events.  **[Permissions](#permissions) required:** *Administer Jira* [global permission](https://confluence.atlassian.com/x/x4dKLg).
752pub async fn get_events(configuration: &configuration::Configuration) -> Result<Vec<crate::models::IssueEvent>, Error<GetEventsError>> {
753    let local_var_configuration = configuration;
754
755    // unbox the parameters
756
757
758    let local_var_client = &local_var_configuration.client;
759
760    let local_var_uri_str = format!("{}/rest/api/2/events", local_var_configuration.base_path);
761    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
762
763    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
764        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
765    }
766    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
767        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
768    };
769    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
770        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
771    };
772
773    let local_var_req = local_var_req_builder.build()?;
774    let local_var_resp = local_var_client.execute(local_var_req).await?;
775
776    let local_var_status = local_var_resp.status();
777    let local_var_content = local_var_resp.text().await?;
778
779    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
780        serde_json::from_str(&local_var_content).map_err(Error::from)
781    } else {
782        let local_var_entity: Option<GetEventsError> = serde_json::from_str(&local_var_content).ok();
783        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
784        Err(Error::ResponseError(local_var_error))
785    }
786}
787
788/// 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.
789pub async fn get_issue(configuration: &configuration::Configuration, params: GetIssueParams) -> Result<crate::models::IssueBean, Error<GetIssueError>> {
790    let local_var_configuration = configuration;
791
792    // unbox the parameters
793    let issue_id_or_key = params.issue_id_or_key;
794    let fields = params.fields;
795    let fields_by_keys = params.fields_by_keys;
796    let expand = params.expand;
797    let properties = params.properties;
798    let update_history = params.update_history;
799
800
801    let local_var_client = &local_var_configuration.client;
802
803    let local_var_uri_str = format!("{}/rest/api/2/issue/{issueIdOrKey}", local_var_configuration.base_path, issueIdOrKey=crate::apis::urlencode(issue_id_or_key));
804    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
805
806    if let Some(ref local_var_str) = fields {
807        local_var_req_builder = match "multi" {
808            "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)>>()),
809            _ => local_var_req_builder.query(&[("fields", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
810        };
811    }
812    if let Some(ref local_var_str) = fields_by_keys {
813        local_var_req_builder = local_var_req_builder.query(&[("fieldsByKeys", &local_var_str.to_string())]);
814    }
815    if let Some(ref local_var_str) = expand {
816        local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
817    }
818    if let Some(ref local_var_str) = properties {
819        local_var_req_builder = match "multi" {
820            "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)>>()),
821            _ => local_var_req_builder.query(&[("properties", &local_var_str.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
822        };
823    }
824    if let Some(ref local_var_str) = update_history {
825        local_var_req_builder = local_var_req_builder.query(&[("updateHistory", &local_var_str.to_string())]);
826    }
827    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
828        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
829    }
830    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
831        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
832    };
833    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
834        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
835    };
836
837    let local_var_req = local_var_req_builder.build()?;
838    let local_var_resp = local_var_client.execute(local_var_req).await?;
839
840    let local_var_status = local_var_resp.status();
841    let local_var_content = local_var_resp.text().await?;
842
843    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
844        serde_json::from_str(&local_var_content).map_err(Error::from)
845    } else {
846        let local_var_entity: Option<GetIssueError> = serde_json::from_str(&local_var_content).ok();
847        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
848        Err(Error::ResponseError(local_var_error))
849    }
850}
851
852/// 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.
853pub async fn get_transitions(configuration: &configuration::Configuration, params: GetTransitionsParams) -> Result<crate::models::Transitions, Error<GetTransitionsError>> {
854    let local_var_configuration = configuration;
855
856    // unbox the parameters
857    let issue_id_or_key = params.issue_id_or_key;
858    let expand = params.expand;
859    let transition_id = params.transition_id;
860    let skip_remote_only_condition = params.skip_remote_only_condition;
861    let include_unavailable_transitions = params.include_unavailable_transitions;
862    let sort_by_ops_bar_and_status = params.sort_by_ops_bar_and_status;
863
864
865    let local_var_client = &local_var_configuration.client;
866
867    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));
868    let mut local_var_req_builder = local_var_client.request(reqwest::Method::GET, local_var_uri_str.as_str());
869
870    if let Some(ref local_var_str) = expand {
871        local_var_req_builder = local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
872    }
873    if let Some(ref local_var_str) = transition_id {
874        local_var_req_builder = local_var_req_builder.query(&[("transitionId", &local_var_str.to_string())]);
875    }
876    if let Some(ref local_var_str) = skip_remote_only_condition {
877        local_var_req_builder = local_var_req_builder.query(&[("skipRemoteOnlyCondition", &local_var_str.to_string())]);
878    }
879    if let Some(ref local_var_str) = include_unavailable_transitions {
880        local_var_req_builder = local_var_req_builder.query(&[("includeUnavailableTransitions", &local_var_str.to_string())]);
881    }
882    if let Some(ref local_var_str) = sort_by_ops_bar_and_status {
883        local_var_req_builder = local_var_req_builder.query(&[("sortByOpsBarAndStatus", &local_var_str.to_string())]);
884    }
885    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
886        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
887    }
888    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
889        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
890    };
891    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
892        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
893    };
894
895    let local_var_req = local_var_req_builder.build()?;
896    let local_var_resp = local_var_client.execute(local_var_req).await?;
897
898    let local_var_status = local_var_resp.status();
899    let local_var_content = local_var_resp.text().await?;
900
901    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
902        serde_json::from_str(&local_var_content).map_err(Error::from)
903    } else {
904        let local_var_entity: Option<GetTransitionsError> = serde_json::from_str(&local_var_content).ok();
905        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
906        Err(Error::ResponseError(local_var_error))
907    }
908}
909
910/// 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.
911pub async fn notify(configuration: &configuration::Configuration, params: NotifyParams) -> Result<serde_json::Value, Error<NotifyError>> {
912    let local_var_configuration = configuration;
913
914    // unbox the parameters
915    let issue_id_or_key = params.issue_id_or_key;
916    let request_body = params.request_body;
917
918
919    let local_var_client = &local_var_configuration.client;
920
921    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));
922    let mut local_var_req_builder = local_var_client.request(reqwest::Method::POST, local_var_uri_str.as_str());
923
924    if let Some(ref local_var_user_agent) = local_var_configuration.user_agent {
925        local_var_req_builder = local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
926    }
927    if let Some(ref local_var_token) = local_var_configuration.oauth_access_token {
928        local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
929    };
930    if let Some(ref local_var_auth_conf) = local_var_configuration.basic_auth {
931        local_var_req_builder = local_var_req_builder.basic_auth(local_var_auth_conf.0.to_owned(), local_var_auth_conf.1.to_owned());
932    };
933    local_var_req_builder = local_var_req_builder.json(&request_body);
934
935    let local_var_req = local_var_req_builder.build()?;
936    let local_var_resp = local_var_client.execute(local_var_req).await?;
937
938    let local_var_status = local_var_resp.status();
939    let local_var_content = local_var_resp.text().await?;
940
941    if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
942        serde_json::from_str(&local_var_content).map_err(Error::from)
943    } else {
944        let local_var_entity: Option<NotifyError> = serde_json::from_str(&local_var_content).ok();
945        let local_var_error = ResponseContent { status: local_var_status, content: local_var_content, entity: local_var_entity };
946        Err(Error::ResponseError(local_var_error))
947    }
948}
949