Actually create the ticket when confirming creation
This commit is contained in:
parent
219f116891
commit
f0aaf0a7e7
1 changed files with 27 additions and 27 deletions
|
@ -211,13 +211,13 @@ fn create_temp_markdown(project_key: Option<String>) -> Result<String, Box<dyn s
|
||||||
Ok(content)
|
Ok(content)
|
||||||
}
|
}
|
||||||
async fn create_jira_issue(
|
async fn create_jira_issue(
|
||||||
_config: &JiraConfig,
|
config: &JiraConfig,
|
||||||
project_key: &str,
|
project_key: &str,
|
||||||
title: &str,
|
title: &str,
|
||||||
description: &str,
|
description: &str,
|
||||||
metadata: &TicketMetadata,
|
metadata: &TicketMetadata,
|
||||||
) -> Result<JiraResponse, Box<dyn std::error::Error>> {
|
) -> Result<JiraResponse, Box<dyn std::error::Error>> {
|
||||||
let _client = reqwest::Client::new();
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
let mut headers = HeaderMap::new();
|
let mut headers = HeaderMap::new();
|
||||||
headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
|
headers.insert(CONTENT_TYPE, HeaderValue::from_static("application/json"));
|
||||||
|
@ -257,32 +257,32 @@ async fn create_jira_issue(
|
||||||
|
|
||||||
let issue = JiraIssueRequest { fields, update };
|
let issue = JiraIssueRequest { fields, update };
|
||||||
|
|
||||||
println!("{:#?}", issue);
|
// println!("{:#?}", issue);
|
||||||
Ok(JiraResponse {
|
// Ok(JiraResponse {
|
||||||
key: format!("{}-1234", project_key),
|
// key: format!("{}-1234", project_key),
|
||||||
})
|
// })
|
||||||
|
|
||||||
// let response = client
|
let response = client
|
||||||
// .post(format!("{}/rest/api/2/issue", config.url))
|
.post(format!("{}/rest/api/2/issue", config.url))
|
||||||
// .basic_auth(&config.email, Some(&config.api_token))
|
.basic_auth(&config.email, Some(&config.api_token))
|
||||||
// .headers(headers)
|
.headers(headers)
|
||||||
// .json(&issue)
|
.json(&issue)
|
||||||
// .send()
|
.send()
|
||||||
// .await?;
|
.await?;
|
||||||
//
|
|
||||||
// if !response.status().is_success() {
|
if !response.status().is_success() {
|
||||||
// let error_text = response.text().await?;
|
let error_text = response.text().await?;
|
||||||
// return Err(format!("Failed to create issue: {}", error_text).into());
|
return Err(format!("Failed to create issue: {}", error_text).into());
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// let issue_response = response.json::<JiraResponse>().await?;
|
let issue_response = response.json::<JiraResponse>().await?;
|
||||||
//
|
|
||||||
// // Update status if specified (requires a separate API call)
|
// Update status if specified (requires a separate API call)
|
||||||
// if let Some(status) = &metadata.status {
|
if let Some(status) = &metadata.status {
|
||||||
// update_issue_status(config, &issue_response.key, status).await?;
|
update_issue_status(config, &issue_response.key, status).await?;
|
||||||
// }
|
}
|
||||||
//
|
|
||||||
// Ok(issue_response)
|
Ok(issue_response)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn update_issue_status(
|
async fn update_issue_status(
|
||||||
|
|
Loading…
Reference in a new issue