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 ArchiveProjectError {
22 Status400(),
23 Status401(),
24 Status403(),
25 Status404(),
26 UnknownValue(serde_json::Value),
27}
28
29#[derive(Debug, Clone, Serialize, Deserialize)]
31#[serde(untagged)]
32pub enum CreateProjectError {
33 Status400(),
34 Status401(),
35 Status403(),
36 UnknownValue(serde_json::Value),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
41#[serde(untagged)]
42pub enum DeleteProjectError {
43 Status401(),
44 Status404(),
45 UnknownValue(serde_json::Value),
46}
47
48#[derive(Debug, Clone, Serialize, Deserialize)]
50#[serde(untagged)]
51pub enum DeleteProjectAsynchronouslyError {
52 Status400(),
53 Status401(),
54 Status404(),
55 UnknownValue(serde_json::Value),
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60#[serde(untagged)]
61pub enum GetAllProjectsError {
62 Status401(),
63 UnknownValue(serde_json::Value),
64}
65
66#[derive(Debug, Clone, Serialize, Deserialize)]
68#[serde(untagged)]
69pub enum GetAllStatusesError {
70 Status401(),
71 Status404(),
72 UnknownValue(serde_json::Value),
73}
74
75#[derive(Debug, Clone, Serialize, Deserialize)]
77#[serde(untagged)]
78pub enum GetHierarchyError {
79 Status400(),
80 Status401(),
81 Status404(),
82 UnknownValue(serde_json::Value),
83}
84
85#[derive(Debug, Clone, Serialize, Deserialize)]
87#[serde(untagged)]
88pub enum GetNotificationSchemeForProjectError {
89 Status400(),
90 Status401(),
91 Status404(),
92 UnknownValue(serde_json::Value),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
97#[serde(untagged)]
98pub enum GetProjectError {
99 Status401(),
100 Status404(),
101 UnknownValue(serde_json::Value),
102}
103
104#[derive(Debug, Clone, Serialize, Deserialize)]
106#[serde(untagged)]
107pub enum RestoreError {
108 Status400(),
109 Status401(),
110 Status404(),
111 UnknownValue(serde_json::Value),
112}
113
114#[derive(Debug, Clone, Serialize, Deserialize)]
116#[serde(untagged)]
117pub enum SearchProjectsError {
118 Status400(),
119 Status401(),
120 Status404(),
121 UnknownValue(serde_json::Value),
122}
123
124#[derive(Debug, Clone, Serialize, Deserialize)]
126#[serde(untagged)]
127pub enum UpdateProjectError {
128 Status400(),
129 Status401(),
130 Status403(),
131 Status404(),
132 UnknownValue(serde_json::Value),
133}
134
135#[derive(Debug, Clone, Serialize, Deserialize)]
137#[serde(untagged)]
138pub enum UpdateProjectTypeError {
139 Status400(),
140 Status401(),
141 Status404(),
142 UnknownValue(serde_json::Value),
143}
144
145
146pub async fn archive_project(configuration: &configuration::Configuration, project_id_or_key: &str) -> Result<serde_json::Value, Error<ArchiveProjectError>> {
148 let p_project_id_or_key = project_id_or_key;
150
151 let uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/archive", configuration.base_path, projectIdOrKey=crate::apis::urlencode(p_project_id_or_key));
152 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
153
154 if let Some(ref user_agent) = configuration.user_agent {
155 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
156 }
157 if let Some(ref token) = configuration.oauth_access_token {
158 req_builder = req_builder.bearer_auth(token.to_owned());
159 };
160 if let Some(ref auth_conf) = configuration.basic_auth {
161 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
162 };
163
164 let req = req_builder.build()?;
165 let resp = configuration.client.execute(req).await?;
166
167 let status = resp.status();
168
169 if !status.is_client_error() && !status.is_server_error() {
170 let content = resp.text().await?;
171 serde_json::from_str(&content).map_err(Error::from)
172 } else {
173 let content = resp.text().await?;
174 let entity: Option<ArchiveProjectError> = serde_json::from_str(&content).ok();
175 Err(Error::ResponseError(ResponseContent { status, content, entity }))
176 }
177}
178
179pub async fn create_project(configuration: &configuration::Configuration, project_input_bean: models::ProjectInputBean) -> Result<models::ProjectIdentifiers, Error<CreateProjectError>> {
181 let p_project_input_bean = project_input_bean;
183
184 let uri_str = format!("{}/rest/api/2/project", configuration.base_path);
185 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
186
187 if let Some(ref user_agent) = configuration.user_agent {
188 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
189 }
190 if let Some(ref token) = configuration.oauth_access_token {
191 req_builder = req_builder.bearer_auth(token.to_owned());
192 };
193 if let Some(ref auth_conf) = configuration.basic_auth {
194 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
195 };
196 req_builder = req_builder.json(&p_project_input_bean);
197
198 let req = req_builder.build()?;
199 let resp = configuration.client.execute(req).await?;
200
201 let status = resp.status();
202
203 if !status.is_client_error() && !status.is_server_error() {
204 let content = resp.text().await?;
205 serde_json::from_str(&content).map_err(Error::from)
206 } else {
207 let content = resp.text().await?;
208 let entity: Option<CreateProjectError> = serde_json::from_str(&content).ok();
209 Err(Error::ResponseError(ResponseContent { status, content, entity }))
210 }
211}
212
213pub async fn delete_project(configuration: &configuration::Configuration, project_id_or_key: &str, enable_undo: Option<bool>) -> Result<(), Error<DeleteProjectError>> {
215 let p_project_id_or_key = project_id_or_key;
217 let p_enable_undo = enable_undo;
218
219 let uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}", configuration.base_path, projectIdOrKey=crate::apis::urlencode(p_project_id_or_key));
220 let mut req_builder = configuration.client.request(reqwest::Method::DELETE, &uri_str);
221
222 if let Some(ref param_value) = p_enable_undo {
223 req_builder = req_builder.query(&[("enableUndo", ¶m_value.to_string())]);
224 }
225 if let Some(ref user_agent) = configuration.user_agent {
226 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
227 }
228 if let Some(ref token) = configuration.oauth_access_token {
229 req_builder = req_builder.bearer_auth(token.to_owned());
230 };
231 if let Some(ref auth_conf) = configuration.basic_auth {
232 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
233 };
234
235 let req = req_builder.build()?;
236 let resp = configuration.client.execute(req).await?;
237
238 let status = resp.status();
239
240 if !status.is_client_error() && !status.is_server_error() {
241 Ok(())
242 } else {
243 let content = resp.text().await?;
244 let entity: Option<DeleteProjectError> = serde_json::from_str(&content).ok();
245 Err(Error::ResponseError(ResponseContent { status, content, entity }))
246 }
247}
248
249pub async fn delete_project_asynchronously(configuration: &configuration::Configuration, project_id_or_key: &str) -> Result<(), Error<DeleteProjectAsynchronouslyError>> {
251 let p_project_id_or_key = project_id_or_key;
253
254 let uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/delete", configuration.base_path, projectIdOrKey=crate::apis::urlencode(p_project_id_or_key));
255 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
256
257 if let Some(ref user_agent) = configuration.user_agent {
258 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
259 }
260 if let Some(ref token) = configuration.oauth_access_token {
261 req_builder = req_builder.bearer_auth(token.to_owned());
262 };
263 if let Some(ref auth_conf) = configuration.basic_auth {
264 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
265 };
266
267 let req = req_builder.build()?;
268 let resp = configuration.client.execute(req).await?;
269
270 let status = resp.status();
271
272 if !status.is_client_error() && !status.is_server_error() {
273 Ok(())
274 } else {
275 let content = resp.text().await?;
276 let entity: Option<DeleteProjectAsynchronouslyError> = serde_json::from_str(&content).ok();
277 Err(Error::ResponseError(ResponseContent { status, content, entity }))
278 }
279}
280
281pub async fn get_all_projects(configuration: &configuration::Configuration, expand: Option<&str>, recent: Option<i32>, properties: Option<Vec<String>>) -> Result<Vec<models::Project>, Error<GetAllProjectsError>> {
283 let p_expand = expand;
285 let p_recent = recent;
286 let p_properties = properties;
287
288 let uri_str = format!("{}/rest/api/2/project", configuration.base_path);
289 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
290
291 if let Some(ref param_value) = p_expand {
292 req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
293 }
294 if let Some(ref param_value) = p_recent {
295 req_builder = req_builder.query(&[("recent", ¶m_value.to_string())]);
296 }
297 if let Some(ref param_value) = p_properties {
298 req_builder = match "multi" {
299 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("properties".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
300 _ => req_builder.query(&[("properties", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
301 };
302 }
303 if let Some(ref user_agent) = configuration.user_agent {
304 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
305 }
306 if let Some(ref token) = configuration.oauth_access_token {
307 req_builder = req_builder.bearer_auth(token.to_owned());
308 };
309 if let Some(ref auth_conf) = configuration.basic_auth {
310 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
311 };
312
313 let req = req_builder.build()?;
314 let resp = configuration.client.execute(req).await?;
315
316 let status = resp.status();
317
318 if !status.is_client_error() && !status.is_server_error() {
319 let content = resp.text().await?;
320 serde_json::from_str(&content).map_err(Error::from)
321 } else {
322 let content = resp.text().await?;
323 let entity: Option<GetAllProjectsError> = serde_json::from_str(&content).ok();
324 Err(Error::ResponseError(ResponseContent { status, content, entity }))
325 }
326}
327
328pub async fn get_all_statuses(configuration: &configuration::Configuration, project_id_or_key: &str) -> Result<Vec<models::IssueTypeWithStatus>, Error<GetAllStatusesError>> {
330 let p_project_id_or_key = project_id_or_key;
332
333 let uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/statuses", configuration.base_path, projectIdOrKey=crate::apis::urlencode(p_project_id_or_key));
334 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
335
336 if let Some(ref user_agent) = configuration.user_agent {
337 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
338 }
339 if let Some(ref token) = configuration.oauth_access_token {
340 req_builder = req_builder.bearer_auth(token.to_owned());
341 };
342 if let Some(ref auth_conf) = configuration.basic_auth {
343 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
344 };
345
346 let req = req_builder.build()?;
347 let resp = configuration.client.execute(req).await?;
348
349 let status = resp.status();
350
351 if !status.is_client_error() && !status.is_server_error() {
352 let content = resp.text().await?;
353 serde_json::from_str(&content).map_err(Error::from)
354 } else {
355 let content = resp.text().await?;
356 let entity: Option<GetAllStatusesError> = serde_json::from_str(&content).ok();
357 Err(Error::ResponseError(ResponseContent { status, content, entity }))
358 }
359}
360
361pub async fn get_hierarchy(configuration: &configuration::Configuration, project_id: i64) -> Result<models::ProjectIssueTypeHierarchy, Error<GetHierarchyError>> {
363 let p_project_id = project_id;
365
366 let uri_str = format!("{}/rest/api/2/project/{projectId}/hierarchy", configuration.base_path, projectId=p_project_id);
367 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
368
369 if let Some(ref user_agent) = configuration.user_agent {
370 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
371 }
372 if let Some(ref token) = configuration.oauth_access_token {
373 req_builder = req_builder.bearer_auth(token.to_owned());
374 };
375 if let Some(ref auth_conf) = configuration.basic_auth {
376 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
377 };
378
379 let req = req_builder.build()?;
380 let resp = configuration.client.execute(req).await?;
381
382 let status = resp.status();
383
384 if !status.is_client_error() && !status.is_server_error() {
385 let content = resp.text().await?;
386 serde_json::from_str(&content).map_err(Error::from)
387 } else {
388 let content = resp.text().await?;
389 let entity: Option<GetHierarchyError> = serde_json::from_str(&content).ok();
390 Err(Error::ResponseError(ResponseContent { status, content, entity }))
391 }
392}
393
394pub async fn get_notification_scheme_for_project(configuration: &configuration::Configuration, project_key_or_id: &str, expand: Option<&str>) -> Result<models::NotificationScheme, Error<GetNotificationSchemeForProjectError>> {
396 let p_project_key_or_id = project_key_or_id;
398 let p_expand = expand;
399
400 let uri_str = format!("{}/rest/api/2/project/{projectKeyOrId}/notificationscheme", configuration.base_path, projectKeyOrId=crate::apis::urlencode(p_project_key_or_id));
401 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
402
403 if let Some(ref param_value) = p_expand {
404 req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
405 }
406 if let Some(ref user_agent) = configuration.user_agent {
407 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
408 }
409 if let Some(ref token) = configuration.oauth_access_token {
410 req_builder = req_builder.bearer_auth(token.to_owned());
411 };
412 if let Some(ref auth_conf) = configuration.basic_auth {
413 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
414 };
415
416 let req = req_builder.build()?;
417 let resp = configuration.client.execute(req).await?;
418
419 let status = resp.status();
420
421 if !status.is_client_error() && !status.is_server_error() {
422 let content = resp.text().await?;
423 serde_json::from_str(&content).map_err(Error::from)
424 } else {
425 let content = resp.text().await?;
426 let entity: Option<GetNotificationSchemeForProjectError> = serde_json::from_str(&content).ok();
427 Err(Error::ResponseError(ResponseContent { status, content, entity }))
428 }
429}
430
431pub async fn get_project(configuration: &configuration::Configuration, project_id_or_key: &str, expand: Option<&str>, properties: Option<Vec<String>>) -> Result<models::Project, Error<GetProjectError>> {
433 let p_project_id_or_key = project_id_or_key;
435 let p_expand = expand;
436 let p_properties = properties;
437
438 let uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}", configuration.base_path, projectIdOrKey=crate::apis::urlencode(p_project_id_or_key));
439 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
440
441 if let Some(ref param_value) = p_expand {
442 req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
443 }
444 if let Some(ref param_value) = p_properties {
445 req_builder = match "multi" {
446 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("properties".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
447 _ => req_builder.query(&[("properties", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
448 };
449 }
450 if let Some(ref user_agent) = configuration.user_agent {
451 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
452 }
453 if let Some(ref token) = configuration.oauth_access_token {
454 req_builder = req_builder.bearer_auth(token.to_owned());
455 };
456 if let Some(ref auth_conf) = configuration.basic_auth {
457 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
458 };
459
460 let req = req_builder.build()?;
461 let resp = configuration.client.execute(req).await?;
462
463 let status = resp.status();
464
465 if !status.is_client_error() && !status.is_server_error() {
466 let content = resp.text().await?;
467 serde_json::from_str(&content).map_err(Error::from)
468 } else {
469 let content = resp.text().await?;
470 let entity: Option<GetProjectError> = serde_json::from_str(&content).ok();
471 Err(Error::ResponseError(ResponseContent { status, content, entity }))
472 }
473}
474
475pub async fn restore(configuration: &configuration::Configuration, project_id_or_key: &str) -> Result<models::Project, Error<RestoreError>> {
477 let p_project_id_or_key = project_id_or_key;
479
480 let uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/restore", configuration.base_path, projectIdOrKey=crate::apis::urlencode(p_project_id_or_key));
481 let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
482
483 if let Some(ref user_agent) = configuration.user_agent {
484 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
485 }
486 if let Some(ref token) = configuration.oauth_access_token {
487 req_builder = req_builder.bearer_auth(token.to_owned());
488 };
489 if let Some(ref auth_conf) = configuration.basic_auth {
490 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
491 };
492
493 let req = req_builder.build()?;
494 let resp = configuration.client.execute(req).await?;
495
496 let status = resp.status();
497
498 if !status.is_client_error() && !status.is_server_error() {
499 let content = resp.text().await?;
500 serde_json::from_str(&content).map_err(Error::from)
501 } else {
502 let content = resp.text().await?;
503 let entity: Option<RestoreError> = serde_json::from_str(&content).ok();
504 Err(Error::ResponseError(ResponseContent { status, content, entity }))
505 }
506}
507
508pub async fn search_projects(configuration: &configuration::Configuration, start_at: Option<i64>, max_results: Option<i32>, order_by: Option<&str>, query: Option<&str>, type_key: Option<&str>, category_id: Option<i64>, action: Option<&str>, expand: Option<&str>, status: Option<Vec<String>>, properties: Option<Vec<serde_json::Value>>, property_query: Option<&str>) -> Result<models::PageBeanProject, Error<SearchProjectsError>> {
510 let p_start_at = start_at;
512 let p_max_results = max_results;
513 let p_order_by = order_by;
514 let p_query = query;
515 let p_type_key = type_key;
516 let p_category_id = category_id;
517 let p_action = action;
518 let p_expand = expand;
519 let p_status = status;
520 let p_properties = properties;
521 let p_property_query = property_query;
522
523 let uri_str = format!("{}/rest/api/2/project/search", configuration.base_path);
524 let mut req_builder = configuration.client.request(reqwest::Method::GET, &uri_str);
525
526 if let Some(ref param_value) = p_start_at {
527 req_builder = req_builder.query(&[("startAt", ¶m_value.to_string())]);
528 }
529 if let Some(ref param_value) = p_max_results {
530 req_builder = req_builder.query(&[("maxResults", ¶m_value.to_string())]);
531 }
532 if let Some(ref param_value) = p_order_by {
533 req_builder = req_builder.query(&[("orderBy", ¶m_value.to_string())]);
534 }
535 if let Some(ref param_value) = p_query {
536 req_builder = req_builder.query(&[("query", ¶m_value.to_string())]);
537 }
538 if let Some(ref param_value) = p_type_key {
539 req_builder = req_builder.query(&[("typeKey", ¶m_value.to_string())]);
540 }
541 if let Some(ref param_value) = p_category_id {
542 req_builder = req_builder.query(&[("categoryId", ¶m_value.to_string())]);
543 }
544 if let Some(ref param_value) = p_action {
545 req_builder = req_builder.query(&[("action", ¶m_value.to_string())]);
546 }
547 if let Some(ref param_value) = p_expand {
548 req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
549 }
550 if let Some(ref param_value) = p_status {
551 req_builder = match "multi" {
552 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("status".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
553 _ => req_builder.query(&[("status", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
554 };
555 }
556 if let Some(ref param_value) = p_properties {
557 req_builder = match "multi" {
558 "multi" => req_builder.query(¶m_value.into_iter().map(|p| ("properties".to_owned(), p.to_string())).collect::<Vec<(std::string::String, std::string::String)>>()),
559 _ => req_builder.query(&[("properties", ¶m_value.into_iter().map(|p| p.to_string()).collect::<Vec<String>>().join(",").to_string())]),
560 };
561 }
562 if let Some(ref param_value) = p_property_query {
563 req_builder = req_builder.query(&[("propertyQuery", ¶m_value.to_string())]);
564 }
565 if let Some(ref user_agent) = configuration.user_agent {
566 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
567 }
568 if let Some(ref token) = configuration.oauth_access_token {
569 req_builder = req_builder.bearer_auth(token.to_owned());
570 };
571 if let Some(ref auth_conf) = configuration.basic_auth {
572 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
573 };
574
575 let req = req_builder.build()?;
576 let resp = configuration.client.execute(req).await?;
577
578 let status = resp.status();
579
580 if !status.is_client_error() && !status.is_server_error() {
581 let content = resp.text().await?;
582 serde_json::from_str(&content).map_err(Error::from)
583 } else {
584 let content = resp.text().await?;
585 let entity: Option<SearchProjectsError> = serde_json::from_str(&content).ok();
586 Err(Error::ResponseError(ResponseContent { status, content, entity }))
587 }
588}
589
590pub async fn update_project(configuration: &configuration::Configuration, project_id_or_key: &str, project_input_bean: models::ProjectInputBean, expand: Option<&str>) -> Result<models::Project, Error<UpdateProjectError>> {
592 let p_project_id_or_key = project_id_or_key;
594 let p_project_input_bean = project_input_bean;
595 let p_expand = expand;
596
597 let uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}", configuration.base_path, projectIdOrKey=crate::apis::urlencode(p_project_id_or_key));
598 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
599
600 if let Some(ref param_value) = p_expand {
601 req_builder = req_builder.query(&[("expand", ¶m_value.to_string())]);
602 }
603 if let Some(ref user_agent) = configuration.user_agent {
604 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
605 }
606 if let Some(ref token) = configuration.oauth_access_token {
607 req_builder = req_builder.bearer_auth(token.to_owned());
608 };
609 if let Some(ref auth_conf) = configuration.basic_auth {
610 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
611 };
612 req_builder = req_builder.json(&p_project_input_bean);
613
614 let req = req_builder.build()?;
615 let resp = configuration.client.execute(req).await?;
616
617 let status = resp.status();
618
619 if !status.is_client_error() && !status.is_server_error() {
620 let content = resp.text().await?;
621 serde_json::from_str(&content).map_err(Error::from)
622 } else {
623 let content = resp.text().await?;
624 let entity: Option<UpdateProjectError> = serde_json::from_str(&content).ok();
625 Err(Error::ResponseError(ResponseContent { status, content, entity }))
626 }
627}
628
629pub async fn update_project_type(configuration: &configuration::Configuration, project_id_or_key: &str, new_project_type_key: &str) -> Result<models::Project, Error<UpdateProjectTypeError>> {
631 let p_project_id_or_key = project_id_or_key;
633 let p_new_project_type_key = new_project_type_key;
634
635 let uri_str = format!("{}/rest/api/2/project/{projectIdOrKey}/type/{newProjectTypeKey}", configuration.base_path, projectIdOrKey=crate::apis::urlencode(p_project_id_or_key), newProjectTypeKey=crate::apis::urlencode(p_new_project_type_key));
636 let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
637
638 if let Some(ref user_agent) = configuration.user_agent {
639 req_builder = req_builder.header(reqwest::header::USER_AGENT, user_agent.clone());
640 }
641 if let Some(ref token) = configuration.oauth_access_token {
642 req_builder = req_builder.bearer_auth(token.to_owned());
643 };
644 if let Some(ref auth_conf) = configuration.basic_auth {
645 req_builder = req_builder.basic_auth(auth_conf.0.to_owned(), auth_conf.1.to_owned());
646 };
647
648 let req = req_builder.build()?;
649 let resp = configuration.client.execute(req).await?;
650
651 let status = resp.status();
652
653 if !status.is_client_error() && !status.is_server_error() {
654 let content = resp.text().await?;
655 serde_json::from_str(&content).map_err(Error::from)
656 } else {
657 let content = resp.text().await?;
658 let entity: Option<UpdateProjectTypeError> = serde_json::from_str(&content).ok();
659 Err(Error::ResponseError(ResponseContent { status, content, entity }))
660 }
661}
662