1use reqwest;
13
14use crate::apis::ResponseContent;
15use super::{Error, configuration};
16
17#[derive(Clone, Debug, Default)]
19pub struct AssignIssueParams {
20 pub issue_id_or_key: String,
22 pub user: crate::models::User
24}
25
26#[derive(Clone, Debug, Default)]
28pub struct CreateIssueParams {
29 pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
30 pub update_history: Option<bool>
32}
33
34#[derive(Clone, Debug, Default)]
36pub struct CreateIssuesParams {
37 pub request_body: ::std::collections::HashMap<String, serde_json::Value>
38}
39
40#[derive(Clone, Debug, Default)]
42pub struct DeleteIssueParams {
43 pub issue_id_or_key: String,
45 pub delete_subtasks: Option<String>
47}
48
49#[derive(Clone, Debug, Default)]
51pub struct DoTransitionParams {
52 pub issue_id_or_key: String,
54 pub request_body: ::std::collections::HashMap<String, serde_json::Value>
55}
56
57#[derive(Clone, Debug, Default)]
59pub struct EditIssueParams {
60 pub issue_id_or_key: String,
62 pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
63 pub notify_users: Option<bool>,
65 pub override_screen_security: Option<bool>,
67 pub override_editable_flag: Option<bool>
69}
70
71#[derive(Clone, Debug, Default)]
73pub struct GetChangeLogsParams {
74 pub issue_id_or_key: String,
76 pub start_at: Option<i32>,
78 pub max_results: Option<i32>
80}
81
82#[derive(Clone, Debug, Default)]
84pub struct GetChangeLogsByIdsParams {
85 pub issue_id_or_key: String,
87 pub issue_changelog_ids: crate::models::IssueChangelogIds
88}
89
90#[derive(Clone, Debug, Default)]
92pub struct GetCreateIssueMetaParams {
93 pub project_ids: Option<Vec<String>>,
95 pub project_keys: Option<Vec<String>>,
97 pub issuetype_ids: Option<Vec<String>>,
99 pub issuetype_names: Option<Vec<String>>,
101 pub expand: Option<String>
103}
104
105#[derive(Clone, Debug, Default)]
107pub struct GetEditIssueMetaParams {
108 pub issue_id_or_key: String,
110 pub override_screen_security: Option<bool>,
112 pub override_editable_flag: Option<bool>
114}
115
116#[derive(Clone, Debug, Default)]
118pub struct GetIssueParams {
119 pub issue_id_or_key: String,
121 pub fields: Option<Vec<String>>,
123 pub fields_by_keys: Option<bool>,
125 pub expand: Option<String>,
127 pub properties: Option<Vec<String>>,
129 pub update_history: Option<bool>
131}
132
133#[derive(Clone, Debug, Default)]
135pub struct GetTransitionsParams {
136 pub issue_id_or_key: String,
138 pub expand: Option<String>,
140 pub transition_id: Option<String>,
142 pub skip_remote_only_condition: Option<bool>,
144 pub include_unavailable_transitions: Option<bool>,
146 pub sort_by_ops_bar_and_status: Option<bool>
148}
149
150#[derive(Clone, Debug, Default)]
152pub struct NotifyParams {
153 pub issue_id_or_key: String,
155 pub request_body: ::std::collections::HashMap<String, serde_json::Value>
157}
158
159
160#[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#[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#[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#[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#[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#[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#[derive(Debug, Clone, Serialize, Deserialize)]
223#[serde(untagged)]
224pub enum GetChangeLogsError {
225 Status404(),
226 UnknownValue(serde_json::Value),
227}
228
229#[derive(Debug, Clone, Serialize, Deserialize)]
231#[serde(untagged)]
232pub enum GetChangeLogsByIdsError {
233 Status400(),
234 Status404(),
235 UnknownValue(serde_json::Value),
236}
237
238#[derive(Debug, Clone, Serialize, Deserialize)]
240#[serde(untagged)]
241pub enum GetCreateIssueMetaError {
242 Status401(),
243 UnknownValue(serde_json::Value),
244}
245
246#[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#[derive(Debug, Clone, Serialize, Deserialize)]
258#[serde(untagged)]
259pub enum GetEventsError {
260 Status401(),
261 Status403(),
262 UnknownValue(serde_json::Value),
263}
264
265#[derive(Debug, Clone, Serialize, Deserialize)]
267#[serde(untagged)]
268pub enum GetIssueError {
269 Status401(),
270 Status404(),
271 UnknownValue(serde_json::Value),
272}
273
274#[derive(Debug, Clone, Serialize, Deserialize)]
276#[serde(untagged)]
277pub enum GetTransitionsError {
278 Status401(),
279 Status404(),
280 UnknownValue(serde_json::Value),
281}
282
283#[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
294pub async fn assign_issue(configuration: &configuration::Configuration, params: AssignIssueParams) -> Result<serde_json::Value, Error<AssignIssueError>> {
296 let local_var_configuration = configuration;
297
298 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
334pub async fn create_issue(configuration: &configuration::Configuration, params: CreateIssueParams) -> Result<crate::models::CreatedIssue, Error<CreateIssueError>> {
336 let local_var_configuration = configuration;
337
338 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
377pub async fn create_issues(configuration: &configuration::Configuration, params: CreateIssuesParams) -> Result<crate::models::CreatedIssues, Error<CreateIssuesError>> {
379 let local_var_configuration = configuration;
380
381 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
416pub async fn delete_issue(configuration: &configuration::Configuration, params: DeleteIssueParams) -> Result<(), Error<DeleteIssueError>> {
418 let local_var_configuration = configuration;
419
420 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
458pub async fn do_transition(configuration: &configuration::Configuration, params: DoTransitionParams) -> Result<serde_json::Value, Error<DoTransitionError>> {
460 let local_var_configuration = configuration;
461
462 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
498pub async fn edit_issue(configuration: &configuration::Configuration, params: EditIssueParams) -> Result<serde_json::Value, Error<EditIssueError>> {
500 let local_var_configuration = configuration;
501
502 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
550pub async fn get_change_logs(configuration: &configuration::Configuration, params: GetChangeLogsParams) -> Result<crate::models::PageBeanChangelog, Error<GetChangeLogsError>> {
552 let local_var_configuration = configuration;
553
554 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
596pub 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 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
636pub 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 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
705pub 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 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
751pub async fn get_events(configuration: &configuration::Configuration) -> Result<Vec<crate::models::IssueEvent>, Error<GetEventsError>> {
753 let local_var_configuration = configuration;
754
755 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
788pub async fn get_issue(configuration: &configuration::Configuration, params: GetIssueParams) -> Result<crate::models::IssueBean, Error<GetIssueError>> {
790 let local_var_configuration = configuration;
791
792 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
852pub async fn get_transitions(configuration: &configuration::Configuration, params: GetTransitionsParams) -> Result<crate::models::Transitions, Error<GetTransitionsError>> {
854 let local_var_configuration = configuration;
855
856 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
910pub async fn notify(configuration: &configuration::Configuration, params: NotifyParams) -> Result<serde_json::Value, Error<NotifyError>> {
912 let local_var_configuration = configuration;
913
914 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