1use reqwest;
13use serde::{Deserialize, Serialize};
14use crate::{apis::ResponseContent, models};
15use super::{Error, configuration};
16
17
18#[derive(Debug, Clone, Serialize, Deserialize)]
20#[serde(untagged)]
21pub enum CreateWorkflowSchemeError {
22 Status400(),
23 Status401(),
24 Status403(),
25 UnknownValue(serde_json::Value),
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
30#[serde(untagged)]
31pub enum DeleteDefaultWorkflowError {
32 Status400(),
33 Status401(),
34 Status403(),
35 Status404(),
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DeleteWorkflowMappingError {
43 Status400(),
44 Status401(),
45 Status403(),
46 Status404(),
47 UnknownValue(serde_json::Value),
48}
49
50#[derive(Debug, Clone, Serialize, Deserialize)]
52#[serde(untagged)]
53pub enum DeleteWorkflowSchemeError {
54 Status400(),
55 Status401(),
56 Status403(),
57 Status404(),
58 UnknownValue(serde_json::Value),
59}
60
61#[derive(Debug, Clone, Serialize, Deserialize)]
63#[serde(untagged)]
64pub enum DeleteWorkflowSchemeIssueTypeError {
65 Status400(),
66 Status401(),
67 Status403(),
68 Status404(),
69 UnknownValue(serde_json::Value),
70}
71
72#[derive(Debug, Clone, Serialize, Deserialize)]
74#[serde(untagged)]
75pub enum GetAllWorkflowSchemesError {
76 Status401(),
77 Status403(),
78 UnknownValue(serde_json::Value),
79}
80
81#[derive(Debug, Clone, Serialize, Deserialize)]
83#[serde(untagged)]
84pub enum GetDefaultWorkflowError {
85 Status401(),
86 Status403(),
87 Status404(),
88 UnknownValue(serde_json::Value),
89}
90
91#[derive(Debug, Clone, Serialize, Deserialize)]
93#[serde(untagged)]
94pub enum GetWorkflowError {
95 Status401(),
96 Status403(),
97 Status404(),
98 UnknownValue(serde_json::Value),
99}
100
101#[derive(Debug, Clone, Serialize, Deserialize)]
103#[serde(untagged)]
104pub enum GetWorkflowSchemeError {
105 Status401(),
106 Status403(),
107 Status404(),
108 UnknownValue(serde_json::Value),
109}
110
111#[derive(Debug, Clone, Serialize, Deserialize)]
113#[serde(untagged)]
114pub enum GetWorkflowSchemeIssueTypeError {
115 Status401(),
116 Status403(),
117 Status404(),
118 UnknownValue(serde_json::Value),
119}
120
121#[derive(Debug, Clone, Serialize, Deserialize)]
123#[serde(untagged)]
124pub enum SetWorkflowSchemeIssueTypeError {
125 Status400(),
126 Status401(),
127 Status403(),
128 Status404(),
129 UnknownValue(serde_json::Value),
130}
131
132#[derive(Debug, Clone, Serialize, Deserialize)]
134#[serde(untagged)]
135pub enum UpdateDefaultWorkflowError {
136 Status400(),
137 Status401(),
138 Status403(),
139 Status404(),
140 UnknownValue(serde_json::Value),
141}
142
143#[derive(Debug, Clone, Serialize, Deserialize)]
145#[serde(untagged)]
146pub enum UpdateWorkflowMappingError {
147 Status400(),
148 Status401(),
149 Status403(),
150 Status404(),
151 UnknownValue(serde_json::Value),
152}
153
154#[derive(Debug, Clone, Serialize, Deserialize)]
156#[serde(untagged)]
157pub enum UpdateWorkflowSchemeError {
158 Status400(),
159 Status401(),
160 Status403(),
161 Status404(),
162 UnknownValue(serde_json::Value),
163}
164
165
166pub async fn create_workflow_scheme(configuration: &configuration::Configuration, workflow_scheme: models::WorkflowScheme) -> Result<models::WorkflowScheme, Error<CreateWorkflowSchemeError>> {
168 let p_workflow_scheme = workflow_scheme;
170
171 let uri_str = format!("{}/rest/api/2/workflowscheme", configuration.base_path);
172 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
173
174 if let Some(ref user_agent) = configuration.user_agent {
175 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
176 }
177 if let Some(ref token) = configuration.oauth_access_token {
178 req_builder = req_builder.bearer_auth(token.to_owned());
179 };
180 if let Some(ref auth_conf) = configuration.basic_auth {
181 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
182 };
183 req_builder = req_builder.json(&p_workflow_scheme);
184
185 let req = req_builder.build()?;
186 let resp = configuration.client.execute(req).await?;
187
188 let status = resp.status();
189
190 if !status.is_client_error() && !status.is_server_error() {
191 let content = resp.text().await?;
192 serde_json::from_str(&content).map_err(Error::from)
193 } else {
194 let content = resp.text().await?;
195 let entity: Option<CreateWorkflowSchemeError> = serde_json::from_str(&content).ok();
196 Err(Error::ResponseError(ResponseContent { status, content, entity }))
197 }
198}
199
200pub async fn delete_default_workflow(configuration: &configuration::Configuration, id: i64, update_draft_if_needed: Option<bool>) -> Result<models::WorkflowScheme, Error<DeleteDefaultWorkflowError>> {
202 let p_id = id;
204 let p_update_draft_if_needed = update_draft_if_needed;
205
206 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}/default", configuration.base_path, id=p_id);
207 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
208
209 if let Some(ref param_value) = p_update_draft_if_needed {
210 req_builder = req_builder.query(&[("updateDraftIfNeeded", ¶m_value.to_string())]);
211 }
212 if let Some(ref user_agent) = configuration.user_agent {
213 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
214 }
215 if let Some(ref token) = configuration.oauth_access_token {
216 req_builder = req_builder.bearer_auth(token.to_owned());
217 };
218 if let Some(ref auth_conf) = configuration.basic_auth {
219 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
220 };
221
222 let req = req_builder.build()?;
223 let resp = configuration.client.execute(req).await?;
224
225 let status = resp.status();
226
227 if !status.is_client_error() && !status.is_server_error() {
228 let content = resp.text().await?;
229 serde_json::from_str(&content).map_err(Error::from)
230 } else {
231 let content = resp.text().await?;
232 let entity: Option<DeleteDefaultWorkflowError> = serde_json::from_str(&content).ok();
233 Err(Error::ResponseError(ResponseContent { status, content, entity }))
234 }
235}
236
237pub async fn delete_workflow_mapping(configuration: &configuration::Configuration, id: i64, workflow_name: &str, update_draft_if_needed: Option<bool>) -> Result<(), Error<DeleteWorkflowMappingError>> {
239 let p_id = id;
241 let p_workflow_name = workflow_name;
242 let p_update_draft_if_needed = update_draft_if_needed;
243
244 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}/workflow", configuration.base_path, id=p_id);
245 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
246
247 req_builder = req_builder.query(&[("workflowName", &p_workflow_name.to_string())]);
248 if let Some(ref param_value) = p_update_draft_if_needed {
249 req_builder = req_builder.query(&[("updateDraftIfNeeded", ¶m_value.to_string())]);
250 }
251 if let Some(ref user_agent) = configuration.user_agent {
252 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
253 }
254 if let Some(ref token) = configuration.oauth_access_token {
255 req_builder = req_builder.bearer_auth(token.to_owned());
256 };
257 if let Some(ref auth_conf) = configuration.basic_auth {
258 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
259 };
260
261 let req = req_builder.build()?;
262 let resp = configuration.client.execute(req).await?;
263
264 let status = resp.status();
265
266 if !status.is_client_error() && !status.is_server_error() {
267 Ok(())
268 } else {
269 let content = resp.text().await?;
270 let entity: Option<DeleteWorkflowMappingError> = serde_json::from_str(&content).ok();
271 Err(Error::ResponseError(ResponseContent { status, content, entity }))
272 }
273}
274
275pub async fn delete_workflow_scheme(configuration: &configuration::Configuration, id: i64) -> Result<(), Error<DeleteWorkflowSchemeError>> {
277 let p_id = id;
279
280 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}", configuration.base_path, id=p_id);
281 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
282
283 if let Some(ref user_agent) = configuration.user_agent {
284 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
285 }
286 if let Some(ref token) = configuration.oauth_access_token {
287 req_builder = req_builder.bearer_auth(token.to_owned());
288 };
289 if let Some(ref auth_conf) = configuration.basic_auth {
290 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
291 };
292
293 let req = req_builder.build()?;
294 let resp = configuration.client.execute(req).await?;
295
296 let status = resp.status();
297
298 if !status.is_client_error() && !status.is_server_error() {
299 Ok(())
300 } else {
301 let content = resp.text().await?;
302 let entity: Option<DeleteWorkflowSchemeError> = serde_json::from_str(&content).ok();
303 Err(Error::ResponseError(ResponseContent { status, content, entity }))
304 }
305}
306
307pub async fn delete_workflow_scheme_issue_type(configuration: &configuration::Configuration, id: i64, issue_type: &str, update_draft_if_needed: Option<bool>) -> Result<models::WorkflowScheme, Error<DeleteWorkflowSchemeIssueTypeError>> {
309 let p_id = id;
311 let p_issue_type = issue_type;
312 let p_update_draft_if_needed = update_draft_if_needed;
313
314 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}/issuetype/{issueType}", configuration.base_path, id=p_id, issueType=crate::apis::urlencode(p_issue_type));
315 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
316
317 if let Some(ref param_value) = p_update_draft_if_needed {
318 req_builder = req_builder.query(&[("updateDraftIfNeeded", ¶m_value.to_string())]);
319 }
320 if let Some(ref user_agent) = configuration.user_agent {
321 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
322 }
323 if let Some(ref token) = configuration.oauth_access_token {
324 req_builder = req_builder.bearer_auth(token.to_owned());
325 };
326 if let Some(ref auth_conf) = configuration.basic_auth {
327 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
328 };
329
330 let req = req_builder.build()?;
331 let resp = configuration.client.execute(req).await?;
332
333 let status = resp.status();
334
335 if !status.is_client_error() && !status.is_server_error() {
336 let content = resp.text().await?;
337 serde_json::from_str(&content).map_err(Error::from)
338 } else {
339 let content = resp.text().await?;
340 let entity: Option<DeleteWorkflowSchemeIssueTypeError> = serde_json::from_str(&content).ok();
341 Err(Error::ResponseError(ResponseContent { status, content, entity }))
342 }
343}
344
345pub async fn get_all_workflow_schemes(configuration: &configuration::Configuration, start_at: Option<i64>, max_results: Option<i32>) -> Result<models::PageBeanWorkflowScheme, Error<GetAllWorkflowSchemesError>> {
347 let p_start_at = start_at;
349 let p_max_results = max_results;
350
351 let uri_str = format!("{}/rest/api/2/workflowscheme", configuration.base_path);
352 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
353
354 if let Some(ref param_value) = p_start_at {
355 req_builder = req_builder.query(&[("startAt", ¶m_value.to_string())]);
356 }
357 if let Some(ref param_value) = p_max_results {
358 req_builder = req_builder.query(&[("maxResults", ¶m_value.to_string())]);
359 }
360 if let Some(ref user_agent) = configuration.user_agent {
361 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
362 }
363 if let Some(ref token) = configuration.oauth_access_token {
364 req_builder = req_builder.bearer_auth(token.to_owned());
365 };
366 if let Some(ref auth_conf) = configuration.basic_auth {
367 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
368 };
369
370 let req = req_builder.build()?;
371 let resp = configuration.client.execute(req).await?;
372
373 let status = resp.status();
374
375 if !status.is_client_error() && !status.is_server_error() {
376 let content = resp.text().await?;
377 serde_json::from_str(&content).map_err(Error::from)
378 } else {
379 let content = resp.text().await?;
380 let entity: Option<GetAllWorkflowSchemesError> = serde_json::from_str(&content).ok();
381 Err(Error::ResponseError(ResponseContent { status, content, entity }))
382 }
383}
384
385pub async fn get_default_workflow(configuration: &configuration::Configuration, id: i64, return_draft_if_exists: Option<bool>) -> Result<models::DefaultWorkflow, Error<GetDefaultWorkflowError>> {
387 let p_id = id;
389 let p_return_draft_if_exists = return_draft_if_exists;
390
391 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}/default", configuration.base_path, id=p_id);
392 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
393
394 if let Some(ref param_value) = p_return_draft_if_exists {
395 req_builder = req_builder.query(&[("returnDraftIfExists", ¶m_value.to_string())]);
396 }
397 if let Some(ref user_agent) = configuration.user_agent {
398 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
399 }
400 if let Some(ref token) = configuration.oauth_access_token {
401 req_builder = req_builder.bearer_auth(token.to_owned());
402 };
403 if let Some(ref auth_conf) = configuration.basic_auth {
404 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
405 };
406
407 let req = req_builder.build()?;
408 let resp = configuration.client.execute(req).await?;
409
410 let status = resp.status();
411
412 if !status.is_client_error() && !status.is_server_error() {
413 let content = resp.text().await?;
414 serde_json::from_str(&content).map_err(Error::from)
415 } else {
416 let content = resp.text().await?;
417 let entity: Option<GetDefaultWorkflowError> = serde_json::from_str(&content).ok();
418 Err(Error::ResponseError(ResponseContent { status, content, entity }))
419 }
420}
421
422pub async fn get_workflow(configuration: &configuration::Configuration, id: i64, workflow_name: Option<&str>, return_draft_if_exists: Option<bool>) -> Result<models::IssueTypesWorkflowMapping, Error<GetWorkflowError>> {
424 let p_id = id;
426 let p_workflow_name = workflow_name;
427 let p_return_draft_if_exists = return_draft_if_exists;
428
429 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}/workflow", configuration.base_path, id=p_id);
430 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
431
432 if let Some(ref param_value) = p_workflow_name {
433 req_builder = req_builder.query(&[("workflowName", ¶m_value.to_string())]);
434 }
435 if let Some(ref param_value) = p_return_draft_if_exists {
436 req_builder = req_builder.query(&[("returnDraftIfExists", ¶m_value.to_string())]);
437 }
438 if let Some(ref user_agent) = configuration.user_agent {
439 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
440 }
441 if let Some(ref token) = configuration.oauth_access_token {
442 req_builder = req_builder.bearer_auth(token.to_owned());
443 };
444 if let Some(ref auth_conf) = configuration.basic_auth {
445 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
446 };
447
448 let req = req_builder.build()?;
449 let resp = configuration.client.execute(req).await?;
450
451 let status = resp.status();
452
453 if !status.is_client_error() && !status.is_server_error() {
454 let content = resp.text().await?;
455 serde_json::from_str(&content).map_err(Error::from)
456 } else {
457 let content = resp.text().await?;
458 let entity: Option<GetWorkflowError> = serde_json::from_str(&content).ok();
459 Err(Error::ResponseError(ResponseContent { status, content, entity }))
460 }
461}
462
463pub async fn get_workflow_scheme(configuration: &configuration::Configuration, id: i64, return_draft_if_exists: Option<bool>) -> Result<models::WorkflowScheme, Error<GetWorkflowSchemeError>> {
465 let p_id = id;
467 let p_return_draft_if_exists = return_draft_if_exists;
468
469 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}", configuration.base_path, id=p_id);
470 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
471
472 if let Some(ref param_value) = p_return_draft_if_exists {
473 req_builder = req_builder.query(&[("returnDraftIfExists", ¶m_value.to_string())]);
474 }
475 if let Some(ref user_agent) = configuration.user_agent {
476 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
477 }
478 if let Some(ref token) = configuration.oauth_access_token {
479 req_builder = req_builder.bearer_auth(token.to_owned());
480 };
481 if let Some(ref auth_conf) = configuration.basic_auth {
482 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
483 };
484
485 let req = req_builder.build()?;
486 let resp = configuration.client.execute(req).await?;
487
488 let status = resp.status();
489
490 if !status.is_client_error() && !status.is_server_error() {
491 let content = resp.text().await?;
492 serde_json::from_str(&content).map_err(Error::from)
493 } else {
494 let content = resp.text().await?;
495 let entity: Option<GetWorkflowSchemeError> = serde_json::from_str(&content).ok();
496 Err(Error::ResponseError(ResponseContent { status, content, entity }))
497 }
498}
499
500pub async fn get_workflow_scheme_issue_type(configuration: &configuration::Configuration, id: i64, issue_type: &str, return_draft_if_exists: Option<bool>) -> Result<models::IssueTypeWorkflowMapping, Error<GetWorkflowSchemeIssueTypeError>> {
502 let p_id = id;
504 let p_issue_type = issue_type;
505 let p_return_draft_if_exists = return_draft_if_exists;
506
507 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}/issuetype/{issueType}", configuration.base_path, id=p_id, issueType=crate::apis::urlencode(p_issue_type));
508 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
509
510 if let Some(ref param_value) = p_return_draft_if_exists {
511 req_builder = req_builder.query(&[("returnDraftIfExists", ¶m_value.to_string())]);
512 }
513 if let Some(ref user_agent) = configuration.user_agent {
514 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
515 }
516 if let Some(ref token) = configuration.oauth_access_token {
517 req_builder = req_builder.bearer_auth(token.to_owned());
518 };
519 if let Some(ref auth_conf) = configuration.basic_auth {
520 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
521 };
522
523 let req = req_builder.build()?;
524 let resp = configuration.client.execute(req).await?;
525
526 let status = resp.status();
527
528 if !status.is_client_error() && !status.is_server_error() {
529 let content = resp.text().await?;
530 serde_json::from_str(&content).map_err(Error::from)
531 } else {
532 let content = resp.text().await?;
533 let entity: Option<GetWorkflowSchemeIssueTypeError> = serde_json::from_str(&content).ok();
534 Err(Error::ResponseError(ResponseContent { status, content, entity }))
535 }
536}
537
538pub async fn set_workflow_scheme_issue_type(configuration: &configuration::Configuration, id: i64, issue_type: &str, issue_type_workflow_mapping: models::IssueTypeWorkflowMapping) -> Result<models::WorkflowScheme, Error<SetWorkflowSchemeIssueTypeError>> {
540 let p_id = id;
542 let p_issue_type = issue_type;
543 let p_issue_type_workflow_mapping = issue_type_workflow_mapping;
544
545 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}/issuetype/{issueType}", configuration.base_path, id=p_id, issueType=crate::apis::urlencode(p_issue_type));
546 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
547
548 if let Some(ref user_agent) = configuration.user_agent {
549 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
550 }
551 if let Some(ref token) = configuration.oauth_access_token {
552 req_builder = req_builder.bearer_auth(token.to_owned());
553 };
554 if let Some(ref auth_conf) = configuration.basic_auth {
555 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
556 };
557 req_builder = req_builder.json(&p_issue_type_workflow_mapping);
558
559 let req = req_builder.build()?;
560 let resp = configuration.client.execute(req).await?;
561
562 let status = resp.status();
563
564 if !status.is_client_error() && !status.is_server_error() {
565 let content = resp.text().await?;
566 serde_json::from_str(&content).map_err(Error::from)
567 } else {
568 let content = resp.text().await?;
569 let entity: Option<SetWorkflowSchemeIssueTypeError> = serde_json::from_str(&content).ok();
570 Err(Error::ResponseError(ResponseContent { status, content, entity }))
571 }
572}
573
574pub async fn update_default_workflow(configuration: &configuration::Configuration, id: i64, default_workflow: models::DefaultWorkflow) -> Result<models::WorkflowScheme, Error<UpdateDefaultWorkflowError>> {
576 let p_id = id;
578 let p_default_workflow = default_workflow;
579
580 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}/default", configuration.base_path, id=p_id);
581 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
582
583 if let Some(ref user_agent) = configuration.user_agent {
584 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
585 }
586 if let Some(ref token) = configuration.oauth_access_token {
587 req_builder = req_builder.bearer_auth(token.to_owned());
588 };
589 if let Some(ref auth_conf) = configuration.basic_auth {
590 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
591 };
592 req_builder = req_builder.json(&p_default_workflow);
593
594 let req = req_builder.build()?;
595 let resp = configuration.client.execute(req).await?;
596
597 let status = resp.status();
598
599 if !status.is_client_error() && !status.is_server_error() {
600 let content = resp.text().await?;
601 serde_json::from_str(&content).map_err(Error::from)
602 } else {
603 let content = resp.text().await?;
604 let entity: Option<UpdateDefaultWorkflowError> = serde_json::from_str(&content).ok();
605 Err(Error::ResponseError(ResponseContent { status, content, entity }))
606 }
607}
608
609pub async fn update_workflow_mapping(configuration: &configuration::Configuration, id: i64, workflow_name: &str, issue_types_workflow_mapping: models::IssueTypesWorkflowMapping) -> Result<models::WorkflowScheme, Error<UpdateWorkflowMappingError>> {
611 let p_id = id;
613 let p_workflow_name = workflow_name;
614 let p_issue_types_workflow_mapping = issue_types_workflow_mapping;
615
616 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}/workflow", configuration.base_path, id=p_id);
617 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
618
619 req_builder = req_builder.query(&[("workflowName", &p_workflow_name.to_string())]);
620 if let Some(ref user_agent) = configuration.user_agent {
621 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
622 }
623 if let Some(ref token) = configuration.oauth_access_token {
624 req_builder = req_builder.bearer_auth(token.to_owned());
625 };
626 if let Some(ref auth_conf) = configuration.basic_auth {
627 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
628 };
629 req_builder = req_builder.json(&p_issue_types_workflow_mapping);
630
631 let req = req_builder.build()?;
632 let resp = configuration.client.execute(req).await?;
633
634 let status = resp.status();
635
636 if !status.is_client_error() && !status.is_server_error() {
637 let content = resp.text().await?;
638 serde_json::from_str(&content).map_err(Error::from)
639 } else {
640 let content = resp.text().await?;
641 let entity: Option<UpdateWorkflowMappingError> = serde_json::from_str(&content).ok();
642 Err(Error::ResponseError(ResponseContent { status, content, entity }))
643 }
644}
645
646pub async fn update_workflow_scheme(configuration: &configuration::Configuration, id: i64, workflow_scheme: models::WorkflowScheme) -> Result<models::WorkflowScheme, Error<UpdateWorkflowSchemeError>> {
648 let p_id = id;
650 let p_workflow_scheme = workflow_scheme;
651
652 let uri_str = format!("{}/rest/api/2/workflowscheme/{id}", configuration.base_path, id=p_id);
653 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
654
655 if let Some(ref user_agent) = configuration.user_agent {
656 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
657 }
658 if let Some(ref token) = configuration.oauth_access_token {
659 req_builder = req_builder.bearer_auth(token.to_owned());
660 };
661 if let Some(ref auth_conf) = configuration.basic_auth {
662 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
663 };
664 req_builder = req_builder.json(&p_workflow_scheme);
665
666 let req = req_builder.build()?;
667 let resp = configuration.client.execute(req).await?;
668
669 let status = resp.status();
670
671 if !status.is_client_error() && !status.is_server_error() {
672 let content = resp.text().await?;
673 serde_json::from_str(&content).map_err(Error::from)
674 } else {
675 let content = resp.text().await?;
676 let entity: Option<UpdateWorkflowSchemeError> = serde_json::from_str(&content).ok();
677 Err(Error::ResponseError(ResponseContent { status, content, entity }))
678 }
679}
680