1use super::{configuration, Error};
12use crate::gen::apis::ResponseContent;
13use crate::gen::models;
14
15#[derive(Clone, Debug)]
17pub struct AssignIssueParams {
18 pub issue_id_or_key: String,
20 pub user: models::User,
22}
23
24#[derive(Clone, Debug)]
26pub struct CreateIssueParams {
27 pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
28 pub update_history: Option<bool>,
30}
31
32#[derive(Clone, Debug)]
34pub struct CreateIssuesParams {
35 pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
36}
37
38#[derive(Clone, Debug)]
40pub struct DeleteIssueParams {
41 pub issue_id_or_key: String,
43 pub delete_subtasks: Option<String>,
45}
46
47#[derive(Clone, Debug)]
49pub struct DoTransitionParams {
50 pub issue_id_or_key: String,
52 pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
53}
54
55#[derive(Clone, Debug)]
57pub struct EditIssueParams {
58 pub issue_id_or_key: String,
60 pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
61 pub notify_users: Option<bool>,
63 pub override_screen_security: Option<bool>,
65 pub override_editable_flag: Option<bool>,
67}
68
69#[derive(Clone, Debug)]
71pub struct GetChangeLogsParams {
72 pub issue_id_or_key: String,
74 pub start_at: Option<i32>,
76 pub max_results: Option<i32>,
78}
79
80#[derive(Clone, Debug)]
82pub struct GetCreateIssueMetaParams {
83 pub project_ids: Option<Vec<String>>,
85 pub project_keys: Option<Vec<String>>,
87 pub issuetype_ids: Option<Vec<String>>,
89 pub issuetype_names: Option<Vec<String>>,
91 pub expand: Option<String>,
93}
94
95#[derive(Clone, Debug)]
97pub struct GetEditIssueMetaParams {
98 pub issue_id_or_key: String,
100 pub override_screen_security: Option<bool>,
102 pub override_editable_flag: Option<bool>,
104}
105
106#[derive(Clone, Debug)]
108pub struct GetIssueParams {
109 pub issue_id_or_key: String,
111 pub fields: Option<Vec<String>>,
113 pub fields_by_keys: Option<bool>,
115 pub expand: Option<String>,
117 pub properties: Option<Vec<String>>,
119 pub update_history: Option<bool>,
121}
122
123#[derive(Clone, Debug)]
125pub struct GetTransitionsParams {
126 pub issue_id_or_key: String,
128 pub expand: Option<String>,
130 pub transition_id: Option<String>,
132 pub skip_remote_only_condition: Option<bool>,
134 pub include_unavailable_transitions: Option<bool>,
136 pub sort_by_ops_bar_and_status: Option<bool>,
138}
139
140#[derive(Clone, Debug)]
142pub struct NotifyParams {
143 pub issue_id_or_key: String,
145 pub request_body: ::std::collections::HashMap<String, serde_json::Value>,
147}
148
149#[derive(Debug, Clone, Serialize, Deserialize)]
151#[serde(untagged)]
152pub enum AssignIssueError {
153 Status400(),
154 Status403(),
155 Status404(),
156 UnknownValue(serde_json::Value),
157}
158
159#[derive(Debug, Clone, Serialize, Deserialize)]
161#[serde(untagged)]
162pub enum CreateIssueError {
163 Status400(models::ErrorCollection),
164 Status401(models::ErrorCollection),
165 Status403(models::ErrorCollection),
166 UnknownValue(serde_json::Value),
167}
168
169#[derive(Debug, Clone, Serialize, Deserialize)]
171#[serde(untagged)]
172pub enum CreateIssuesError {
173 Status400(models::CreatedIssues),
174 Status401(),
175 UnknownValue(serde_json::Value),
176}
177
178#[derive(Debug, Clone, Serialize, Deserialize)]
180#[serde(untagged)]
181pub enum DeleteIssueError {
182 Status400(),
183 Status401(),
184 Status403(),
185 Status404(),
186 UnknownValue(serde_json::Value),
187}
188
189#[derive(Debug, Clone, Serialize, Deserialize)]
191#[serde(untagged)]
192pub enum DoTransitionError {
193 Status400(),
194 Status401(),
195 Status404(),
196 UnknownValue(serde_json::Value),
197}
198
199#[derive(Debug, Clone, Serialize, Deserialize)]
201#[serde(untagged)]
202pub enum EditIssueError {
203 Status400(),
204 Status401(),
205 Status403(),
206 Status404(),
207 UnknownValue(serde_json::Value),
208}
209
210#[derive(Debug, Clone, Serialize, Deserialize)]
212#[serde(untagged)]
213pub enum GetChangeLogsError {
214 Status404(),
215 UnknownValue(serde_json::Value),
216}
217
218#[derive(Debug, Clone, Serialize, Deserialize)]
220#[serde(untagged)]
221pub enum GetCreateIssueMetaError {
222 Status401(),
223 UnknownValue(serde_json::Value),
224}
225
226#[derive(Debug, Clone, Serialize, Deserialize)]
228#[serde(untagged)]
229pub enum GetEditIssueMetaError {
230 Status401(),
231 Status403(),
232 Status404(),
233 UnknownValue(serde_json::Value),
234}
235
236#[derive(Debug, Clone, Serialize, Deserialize)]
238#[serde(untagged)]
239pub enum GetIssueError {
240 Status401(),
241 Status404(),
242 UnknownValue(serde_json::Value),
243}
244
245#[derive(Debug, Clone, Serialize, Deserialize)]
247#[serde(untagged)]
248pub enum GetTransitionsError {
249 Status401(),
250 Status404(),
251 UnknownValue(serde_json::Value),
252}
253
254#[derive(Debug, Clone, Serialize, Deserialize)]
256#[serde(untagged)]
257pub enum NotifyError {
258 Status400(),
259 Status403(),
260 Status404(),
261 UnknownValue(serde_json::Value),
262}
263
264pub async fn assign_issue(
266 configuration: &configuration::Configuration,
267 params: AssignIssueParams,
268) -> Result<serde_json::Value, Error<AssignIssueError>> {
269 let issue_id_or_key = params.issue_id_or_key;
271 let user = params.user;
272
273 let local_var_client = &configuration.client;
274
275 let local_var_uri_str = format!(
276 "{}/rest/api/3/issue/{issueIdOrKey}/assignee",
277 configuration.base_path,
278 issueIdOrKey = crate::gen::apis::urlencode(issue_id_or_key)
279 );
280 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
281
282 if let Some(ref local_var_user_agent) = configuration.user_agent {
283 local_var_req_builder =
284 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
285 }
286 if let Some(ref local_var_token) = configuration.oauth_access_token {
287 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
288 };
289 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
290 local_var_req_builder = local_var_req_builder.basic_auth(
291 local_var_auth_conf.0.to_owned(),
292 local_var_auth_conf.1.to_owned(),
293 );
294 };
295 local_var_req_builder = local_var_req_builder.json(&user);
296
297 let local_var_req = local_var_req_builder.build()?;
298 let local_var_resp = local_var_client.execute(local_var_req).await?;
299
300 let local_var_status = local_var_resp.status();
301 let local_var_content = local_var_resp.text().await?;
302
303 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
304 serde_json::from_str(&local_var_content).map_err(Error::from)
305 } else {
306 let local_var_entity: Option<AssignIssueError> =
307 serde_json::from_str(&local_var_content).ok();
308 let local_var_error = ResponseContent {
309 status: local_var_status,
310 content: local_var_content,
311 entity: local_var_entity,
312 };
313 Err(Error::ResponseError(local_var_error))
314 }
315}
316
317pub async fn create_issue(
319 configuration: &configuration::Configuration,
320 params: CreateIssueParams,
321) -> Result<models::CreatedIssue, Error<CreateIssueError>> {
322 let request_body = params.request_body;
324 let update_history = params.update_history;
325
326 let local_var_client = &configuration.client;
327
328 let local_var_uri_str = format!("{}/rest/api/3/issue", configuration.base_path);
329 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
330
331 if let Some(ref local_var_str) = update_history {
332 local_var_req_builder =
333 local_var_req_builder.query(&[("updateHistory", &local_var_str.to_string())]);
334 }
335 if let Some(ref local_var_user_agent) = configuration.user_agent {
336 local_var_req_builder =
337 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
338 }
339 if let Some(ref local_var_token) = configuration.oauth_access_token {
340 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
341 };
342 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
343 local_var_req_builder = local_var_req_builder.basic_auth(
344 local_var_auth_conf.0.to_owned(),
345 local_var_auth_conf.1.to_owned(),
346 );
347 };
348 local_var_req_builder = local_var_req_builder.json(&request_body);
349
350 let local_var_req = local_var_req_builder.build()?;
351 let local_var_resp = local_var_client.execute(local_var_req).await?;
352
353 let local_var_status = local_var_resp.status();
354 let local_var_content = local_var_resp.text().await?;
355
356 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
357 serde_json::from_str(&local_var_content).map_err(Error::from)
358 } else {
359 let local_var_entity: Option<CreateIssueError> =
360 serde_json::from_str(&local_var_content).ok();
361 let local_var_error = ResponseContent {
362 status: local_var_status,
363 content: local_var_content,
364 entity: local_var_entity,
365 };
366 Err(Error::ResponseError(local_var_error))
367 }
368}
369
370pub async fn create_issues(
372 configuration: &configuration::Configuration,
373 params: CreateIssuesParams,
374) -> Result<models::CreatedIssues, Error<CreateIssuesError>> {
375 let request_body = params.request_body;
377
378 let local_var_client = &configuration.client;
379
380 let local_var_uri_str = format!("{}/rest/api/3/issue/bulk", configuration.base_path);
381 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
382
383 if let Some(ref local_var_user_agent) = configuration.user_agent {
384 local_var_req_builder =
385 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
386 }
387 if let Some(ref local_var_token) = configuration.oauth_access_token {
388 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
389 };
390 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
391 local_var_req_builder = local_var_req_builder.basic_auth(
392 local_var_auth_conf.0.to_owned(),
393 local_var_auth_conf.1.to_owned(),
394 );
395 };
396 local_var_req_builder = local_var_req_builder.json(&request_body);
397
398 let local_var_req = local_var_req_builder.build()?;
399 let local_var_resp = local_var_client.execute(local_var_req).await?;
400
401 let local_var_status = local_var_resp.status();
402 let local_var_content = local_var_resp.text().await?;
403
404 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
405 serde_json::from_str(&local_var_content).map_err(Error::from)
406 } else {
407 let local_var_entity: Option<CreateIssuesError> =
408 serde_json::from_str(&local_var_content).ok();
409 let local_var_error = ResponseContent {
410 status: local_var_status,
411 content: local_var_content,
412 entity: local_var_entity,
413 };
414 Err(Error::ResponseError(local_var_error))
415 }
416}
417
418pub async fn delete_issue(
420 configuration: &configuration::Configuration,
421 params: DeleteIssueParams,
422) -> Result<(), Error<DeleteIssueError>> {
423 let issue_id_or_key = params.issue_id_or_key;
425 let delete_subtasks = params.delete_subtasks;
426
427 let local_var_client = &configuration.client;
428
429 let local_var_uri_str = format!(
430 "{}/rest/api/3/issue/{issueIdOrKey}",
431 configuration.base_path,
432 issueIdOrKey = crate::gen::apis::urlencode(issue_id_or_key)
433 );
434 let mut local_var_req_builder = local_var_client.delete(local_var_uri_str.as_str());
435
436 if let Some(ref local_var_str) = delete_subtasks {
437 local_var_req_builder =
438 local_var_req_builder.query(&[("deleteSubtasks", &local_var_str.to_string())]);
439 }
440 if let Some(ref local_var_user_agent) = configuration.user_agent {
441 local_var_req_builder =
442 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
443 }
444 if let Some(ref local_var_token) = configuration.oauth_access_token {
445 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
446 };
447 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
448 local_var_req_builder = local_var_req_builder.basic_auth(
449 local_var_auth_conf.0.to_owned(),
450 local_var_auth_conf.1.to_owned(),
451 );
452 };
453
454 let local_var_req = local_var_req_builder.build()?;
455 let local_var_resp = local_var_client.execute(local_var_req).await?;
456
457 let local_var_status = local_var_resp.status();
458 let local_var_content = local_var_resp.text().await?;
459
460 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
461 Ok(())
462 } else {
463 let local_var_entity: Option<DeleteIssueError> =
464 serde_json::from_str(&local_var_content).ok();
465 let local_var_error = ResponseContent {
466 status: local_var_status,
467 content: local_var_content,
468 entity: local_var_entity,
469 };
470 Err(Error::ResponseError(local_var_error))
471 }
472}
473
474pub async fn do_transition(
476 configuration: &configuration::Configuration,
477 params: DoTransitionParams,
478) -> Result<serde_json::Value, Error<DoTransitionError>> {
479 let issue_id_or_key = params.issue_id_or_key;
481 let request_body = params.request_body;
482
483 let local_var_client = &configuration.client;
484
485 let local_var_uri_str = format!(
486 "{}/rest/api/3/issue/{issueIdOrKey}/transitions",
487 configuration.base_path,
488 issueIdOrKey = crate::gen::apis::urlencode(issue_id_or_key)
489 );
490 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
491
492 if let Some(ref local_var_user_agent) = configuration.user_agent {
493 local_var_req_builder =
494 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
495 }
496 if let Some(ref local_var_token) = configuration.oauth_access_token {
497 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
498 };
499 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
500 local_var_req_builder = local_var_req_builder.basic_auth(
501 local_var_auth_conf.0.to_owned(),
502 local_var_auth_conf.1.to_owned(),
503 );
504 };
505 local_var_req_builder = local_var_req_builder.json(&request_body);
506
507 let local_var_req = local_var_req_builder.build()?;
508 let local_var_resp = local_var_client.execute(local_var_req).await?;
509
510 let local_var_status = local_var_resp.status();
511 let local_var_content = local_var_resp.text().await?;
512
513 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
514 serde_json::from_str(&local_var_content).map_err(Error::from)
515 } else {
516 let local_var_entity: Option<DoTransitionError> =
517 serde_json::from_str(&local_var_content).ok();
518 let local_var_error = ResponseContent {
519 status: local_var_status,
520 content: local_var_content,
521 entity: local_var_entity,
522 };
523 Err(Error::ResponseError(local_var_error))
524 }
525}
526
527pub async fn edit_issue(
529 configuration: &configuration::Configuration,
530 params: EditIssueParams,
531) -> Result<serde_json::Value, Error<EditIssueError>> {
532 let issue_id_or_key = params.issue_id_or_key;
534 let request_body = params.request_body;
535 let notify_users = params.notify_users;
536 let override_screen_security = params.override_screen_security;
537 let override_editable_flag = params.override_editable_flag;
538
539 let local_var_client = &configuration.client;
540
541 let local_var_uri_str = format!(
542 "{}/rest/api/3/issue/{issueIdOrKey}",
543 configuration.base_path,
544 issueIdOrKey = crate::gen::apis::urlencode(issue_id_or_key)
545 );
546 let mut local_var_req_builder = local_var_client.put(local_var_uri_str.as_str());
547
548 if let Some(ref local_var_str) = notify_users {
549 local_var_req_builder =
550 local_var_req_builder.query(&[("notifyUsers", &local_var_str.to_string())]);
551 }
552 if let Some(ref local_var_str) = override_screen_security {
553 local_var_req_builder =
554 local_var_req_builder.query(&[("overrideScreenSecurity", &local_var_str.to_string())]);
555 }
556 if let Some(ref local_var_str) = override_editable_flag {
557 local_var_req_builder =
558 local_var_req_builder.query(&[("overrideEditableFlag", &local_var_str.to_string())]);
559 }
560 if let Some(ref local_var_user_agent) = configuration.user_agent {
561 local_var_req_builder =
562 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
563 }
564 if let Some(ref local_var_token) = configuration.oauth_access_token {
565 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
566 };
567 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
568 local_var_req_builder = local_var_req_builder.basic_auth(
569 local_var_auth_conf.0.to_owned(),
570 local_var_auth_conf.1.to_owned(),
571 );
572 };
573 local_var_req_builder = local_var_req_builder.json(&request_body);
574
575 let local_var_req = local_var_req_builder.build()?;
576 let local_var_resp = local_var_client.execute(local_var_req).await?;
577
578 let local_var_status = local_var_resp.status();
579 let local_var_content = local_var_resp.text().await?;
580
581 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
582 serde_json::from_str(&local_var_content).map_err(Error::from)
583 } else {
584 let local_var_entity: Option<EditIssueError> =
585 serde_json::from_str(&local_var_content).ok();
586 let local_var_error = ResponseContent {
587 status: local_var_status,
588 content: local_var_content,
589 entity: local_var_entity,
590 };
591 Err(Error::ResponseError(local_var_error))
592 }
593}
594
595pub async fn get_change_logs(
597 configuration: &configuration::Configuration,
598 params: GetChangeLogsParams,
599) -> Result<models::PageBeanChangelog, Error<GetChangeLogsError>> {
600 let issue_id_or_key = params.issue_id_or_key;
602 let start_at = params.start_at;
603 let max_results = params.max_results;
604
605 let local_var_client = &configuration.client;
606
607 let local_var_uri_str = format!(
608 "{}/rest/api/3/issue/{issueIdOrKey}/changelog",
609 configuration.base_path,
610 issueIdOrKey = crate::gen::apis::urlencode(issue_id_or_key)
611 );
612 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
613
614 if let Some(ref local_var_str) = start_at {
615 local_var_req_builder =
616 local_var_req_builder.query(&[("startAt", &local_var_str.to_string())]);
617 }
618 if let Some(ref local_var_str) = max_results {
619 local_var_req_builder =
620 local_var_req_builder.query(&[("maxResults", &local_var_str.to_string())]);
621 }
622 if let Some(ref local_var_user_agent) = configuration.user_agent {
623 local_var_req_builder =
624 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
625 }
626 if let Some(ref local_var_token) = configuration.oauth_access_token {
627 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
628 };
629 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
630 local_var_req_builder = local_var_req_builder.basic_auth(
631 local_var_auth_conf.0.to_owned(),
632 local_var_auth_conf.1.to_owned(),
633 );
634 };
635
636 let local_var_req = local_var_req_builder.build()?;
637 let local_var_resp = local_var_client.execute(local_var_req).await?;
638
639 let local_var_status = local_var_resp.status();
640 let local_var_content = local_var_resp.text().await?;
641
642 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
643 serde_json::from_str(&local_var_content).map_err(Error::from)
644 } else {
645 let local_var_entity: Option<GetChangeLogsError> =
646 serde_json::from_str(&local_var_content).ok();
647 let local_var_error = ResponseContent {
648 status: local_var_status,
649 content: local_var_content,
650 entity: local_var_entity,
651 };
652 Err(Error::ResponseError(local_var_error))
653 }
654}
655
656pub async fn get_create_issue_meta(
658 configuration: &configuration::Configuration,
659 params: GetCreateIssueMetaParams,
660) -> Result<models::IssueCreateMetadata, Error<GetCreateIssueMetaError>> {
661 let project_ids = params.project_ids;
663 let project_keys = params.project_keys;
664 let issuetype_ids = params.issuetype_ids;
665 let issuetype_names = params.issuetype_names;
666 let expand = params.expand;
667
668 let local_var_client = &configuration.client;
669
670 let local_var_uri_str = format!("{}/rest/api/3/issue/createmeta", configuration.base_path);
671 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
672
673 if let Some(ref local_var_str) = project_ids {
674 local_var_req_builder = local_var_req_builder.query(&[(
675 "projectIds",
676 &local_var_str
677 .into_iter()
678 .map(|p| p.to_string())
679 .collect::<Vec<String>>()
680 .join(",")
681 .to_string(),
682 )]);
683 }
684 if let Some(ref local_var_str) = project_keys {
685 local_var_req_builder = local_var_req_builder.query(&[(
686 "projectKeys",
687 &local_var_str
688 .into_iter()
689 .map(|p| p.to_string())
690 .collect::<Vec<String>>()
691 .join(",")
692 .to_string(),
693 )]);
694 }
695 if let Some(ref local_var_str) = issuetype_ids {
696 local_var_req_builder = local_var_req_builder.query(&[(
697 "issuetypeIds",
698 &local_var_str
699 .into_iter()
700 .map(|p| p.to_string())
701 .collect::<Vec<String>>()
702 .join(",")
703 .to_string(),
704 )]);
705 }
706 if let Some(ref local_var_str) = issuetype_names {
707 local_var_req_builder = local_var_req_builder.query(&[(
708 "issuetypeNames",
709 &local_var_str
710 .into_iter()
711 .map(|p| p.to_string())
712 .collect::<Vec<String>>()
713 .join(",")
714 .to_string(),
715 )]);
716 }
717 if let Some(ref local_var_str) = expand {
718 local_var_req_builder =
719 local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
720 }
721 if let Some(ref local_var_user_agent) = configuration.user_agent {
722 local_var_req_builder =
723 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
724 }
725 if let Some(ref local_var_token) = configuration.oauth_access_token {
726 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
727 };
728 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
729 local_var_req_builder = local_var_req_builder.basic_auth(
730 local_var_auth_conf.0.to_owned(),
731 local_var_auth_conf.1.to_owned(),
732 );
733 };
734
735 let local_var_req = local_var_req_builder.build()?;
736 let local_var_resp = local_var_client.execute(local_var_req).await?;
737
738 let local_var_status = local_var_resp.status();
739 let local_var_content = local_var_resp.text().await?;
740
741 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
742 serde_json::from_str(&local_var_content).map_err(Error::from)
743 } else {
744 let local_var_entity: Option<GetCreateIssueMetaError> =
745 serde_json::from_str(&local_var_content).ok();
746 let local_var_error = ResponseContent {
747 status: local_var_status,
748 content: local_var_content,
749 entity: local_var_entity,
750 };
751 Err(Error::ResponseError(local_var_error))
752 }
753}
754
755pub async fn get_edit_issue_meta(
757 configuration: &configuration::Configuration,
758 params: GetEditIssueMetaParams,
759) -> Result<models::IssueUpdateMetadata, Error<GetEditIssueMetaError>> {
760 let issue_id_or_key = params.issue_id_or_key;
762 let override_screen_security = params.override_screen_security;
763 let override_editable_flag = params.override_editable_flag;
764
765 let local_var_client = &configuration.client;
766
767 let local_var_uri_str = format!(
768 "{}/rest/api/3/issue/{issueIdOrKey}/editmeta",
769 configuration.base_path,
770 issueIdOrKey = crate::gen::apis::urlencode(issue_id_or_key)
771 );
772 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
773
774 if let Some(ref local_var_str) = override_screen_security {
775 local_var_req_builder =
776 local_var_req_builder.query(&[("overrideScreenSecurity", &local_var_str.to_string())]);
777 }
778 if let Some(ref local_var_str) = override_editable_flag {
779 local_var_req_builder =
780 local_var_req_builder.query(&[("overrideEditableFlag", &local_var_str.to_string())]);
781 }
782 if let Some(ref local_var_user_agent) = configuration.user_agent {
783 local_var_req_builder =
784 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
785 }
786 if let Some(ref local_var_token) = configuration.oauth_access_token {
787 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
788 };
789 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
790 local_var_req_builder = local_var_req_builder.basic_auth(
791 local_var_auth_conf.0.to_owned(),
792 local_var_auth_conf.1.to_owned(),
793 );
794 };
795
796 let local_var_req = local_var_req_builder.build()?;
797 let local_var_resp = local_var_client.execute(local_var_req).await?;
798
799 let local_var_status = local_var_resp.status();
800 let local_var_content = local_var_resp.text().await?;
801
802 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
803 serde_json::from_str(&local_var_content).map_err(Error::from)
804 } else {
805 let local_var_entity: Option<GetEditIssueMetaError> =
806 serde_json::from_str(&local_var_content).ok();
807 let local_var_error = ResponseContent {
808 status: local_var_status,
809 content: local_var_content,
810 entity: local_var_entity,
811 };
812 Err(Error::ResponseError(local_var_error))
813 }
814}
815
816pub async fn get_issue(
818 configuration: &configuration::Configuration,
819 params: GetIssueParams,
820) -> Result<models::IssueBean, Error<GetIssueError>> {
821 let issue_id_or_key = params.issue_id_or_key;
823 let fields = params.fields;
824 let fields_by_keys = params.fields_by_keys;
825 let expand = params.expand;
826 let properties = params.properties;
827 let update_history = params.update_history;
828
829 let local_var_client = &configuration.client;
830
831 let local_var_uri_str = format!(
832 "{}/rest/api/3/issue/{issueIdOrKey}",
833 configuration.base_path,
834 issueIdOrKey = crate::gen::apis::urlencode(issue_id_or_key)
835 );
836 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
837
838 if let Some(ref local_var_str) = fields {
839 local_var_req_builder = local_var_req_builder.query(&[(
840 "fields",
841 &local_var_str
842 .into_iter()
843 .map(|p| p.to_string())
844 .collect::<Vec<String>>()
845 .join(",")
846 .to_string(),
847 )]);
848 }
849 if let Some(ref local_var_str) = fields_by_keys {
850 local_var_req_builder =
851 local_var_req_builder.query(&[("fieldsByKeys", &local_var_str.to_string())]);
852 }
853 if let Some(ref local_var_str) = expand {
854 local_var_req_builder =
855 local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
856 }
857 if let Some(ref local_var_str) = properties {
858 local_var_req_builder = local_var_req_builder.query(&[(
859 "properties",
860 &local_var_str
861 .into_iter()
862 .map(|p| p.to_string())
863 .collect::<Vec<String>>()
864 .join(",")
865 .to_string(),
866 )]);
867 }
868 if let Some(ref local_var_str) = update_history {
869 local_var_req_builder =
870 local_var_req_builder.query(&[("updateHistory", &local_var_str.to_string())]);
871 }
872 if let Some(ref local_var_user_agent) = configuration.user_agent {
873 local_var_req_builder =
874 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
875 }
876 if let Some(ref local_var_token) = configuration.oauth_access_token {
877 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
878 };
879 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
880 local_var_req_builder = local_var_req_builder.basic_auth(
881 local_var_auth_conf.0.to_owned(),
882 local_var_auth_conf.1.to_owned(),
883 );
884 };
885
886 let local_var_req = local_var_req_builder.build()?;
887 let local_var_resp = local_var_client.execute(local_var_req).await?;
888
889 let local_var_status = local_var_resp.status();
890 let local_var_content = local_var_resp.text().await?;
891
892 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
893 serde_json::from_str(&local_var_content).map_err(Error::from)
894 } else {
895 let local_var_entity: Option<GetIssueError> = serde_json::from_str(&local_var_content).ok();
896 let local_var_error = ResponseContent {
897 status: local_var_status,
898 content: local_var_content,
899 entity: local_var_entity,
900 };
901 Err(Error::ResponseError(local_var_error))
902 }
903}
904
905pub async fn get_transitions(
907 configuration: &configuration::Configuration,
908 params: GetTransitionsParams,
909) -> Result<models::Transitions, Error<GetTransitionsError>> {
910 let issue_id_or_key = params.issue_id_or_key;
912 let expand = params.expand;
913 let transition_id = params.transition_id;
914 let skip_remote_only_condition = params.skip_remote_only_condition;
915 let include_unavailable_transitions = params.include_unavailable_transitions;
916 let sort_by_ops_bar_and_status = params.sort_by_ops_bar_and_status;
917
918 let local_var_client = &configuration.client;
919
920 let local_var_uri_str = format!(
921 "{}/rest/api/3/issue/{issueIdOrKey}/transitions",
922 configuration.base_path,
923 issueIdOrKey = crate::gen::apis::urlencode(issue_id_or_key)
924 );
925 let mut local_var_req_builder = local_var_client.get(local_var_uri_str.as_str());
926
927 if let Some(ref local_var_str) = expand {
928 local_var_req_builder =
929 local_var_req_builder.query(&[("expand", &local_var_str.to_string())]);
930 }
931 if let Some(ref local_var_str) = transition_id {
932 local_var_req_builder =
933 local_var_req_builder.query(&[("transitionId", &local_var_str.to_string())]);
934 }
935 if let Some(ref local_var_str) = skip_remote_only_condition {
936 local_var_req_builder =
937 local_var_req_builder.query(&[("skipRemoteOnlyCondition", &local_var_str.to_string())]);
938 }
939 if let Some(ref local_var_str) = include_unavailable_transitions {
940 local_var_req_builder = local_var_req_builder
941 .query(&[("includeUnavailableTransitions", &local_var_str.to_string())]);
942 }
943 if let Some(ref local_var_str) = sort_by_ops_bar_and_status {
944 local_var_req_builder =
945 local_var_req_builder.query(&[("sortByOpsBarAndStatus", &local_var_str.to_string())]);
946 }
947 if let Some(ref local_var_user_agent) = configuration.user_agent {
948 local_var_req_builder =
949 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
950 }
951 if let Some(ref local_var_token) = configuration.oauth_access_token {
952 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
953 };
954 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
955 local_var_req_builder = local_var_req_builder.basic_auth(
956 local_var_auth_conf.0.to_owned(),
957 local_var_auth_conf.1.to_owned(),
958 );
959 };
960
961 let local_var_req = local_var_req_builder.build()?;
962 let local_var_resp = local_var_client.execute(local_var_req).await?;
963
964 let local_var_status = local_var_resp.status();
965 let local_var_content = local_var_resp.text().await?;
966
967 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
968 serde_json::from_str(&local_var_content).map_err(Error::from)
969 } else {
970 let local_var_entity: Option<GetTransitionsError> =
971 serde_json::from_str(&local_var_content).ok();
972 let local_var_error = ResponseContent {
973 status: local_var_status,
974 content: local_var_content,
975 entity: local_var_entity,
976 };
977 Err(Error::ResponseError(local_var_error))
978 }
979}
980
981pub async fn notify(
983 configuration: &configuration::Configuration,
984 params: NotifyParams,
985) -> Result<serde_json::Value, Error<NotifyError>> {
986 let issue_id_or_key = params.issue_id_or_key;
988 let request_body = params.request_body;
989
990 let local_var_client = &configuration.client;
991
992 let local_var_uri_str = format!(
993 "{}/rest/api/3/issue/{issueIdOrKey}/notify",
994 configuration.base_path,
995 issueIdOrKey = crate::gen::apis::urlencode(issue_id_or_key)
996 );
997 let mut local_var_req_builder = local_var_client.post(local_var_uri_str.as_str());
998
999 if let Some(ref local_var_user_agent) = configuration.user_agent {
1000 local_var_req_builder =
1001 local_var_req_builder.header(reqwest::header::USER_AGENT, local_var_user_agent.clone());
1002 }
1003 if let Some(ref local_var_token) = configuration.oauth_access_token {
1004 local_var_req_builder = local_var_req_builder.bearer_auth(local_var_token.to_owned());
1005 };
1006 if let Some(ref local_var_auth_conf) = configuration.basic_auth {
1007 local_var_req_builder = local_var_req_builder.basic_auth(
1008 local_var_auth_conf.0.to_owned(),
1009 local_var_auth_conf.1.to_owned(),
1010 );
1011 };
1012 local_var_req_builder = local_var_req_builder.json(&request_body);
1013
1014 let local_var_req = local_var_req_builder.build()?;
1015 let local_var_resp = local_var_client.execute(local_var_req).await?;
1016
1017 let local_var_status = local_var_resp.status();
1018 let local_var_content = local_var_resp.text().await?;
1019
1020 if !local_var_status.is_client_error() && !local_var_status.is_server_error() {
1021 serde_json::from_str(&local_var_content).map_err(Error::from)
1022 } else {
1023 let local_var_entity: Option<NotifyError> = serde_json::from_str(&local_var_content).ok();
1024 let local_var_error = ResponseContent {
1025 status: local_var_status,
1026 content: local_var_content,
1027 entity: local_var_entity,
1028 };
1029 Err(Error::ResponseError(local_var_error))
1030 }
1031}