Compare commits
No commits in common. "f0aaf0a7e79a2d4ac51d84e19be55de1fca13777" and "43e32a303dd5642314066f4ad75e8f003e1f75db" have entirely different histories.
f0aaf0a7e7
...
43e32a303d
1 changed files with 29 additions and 39 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(
|
||||||
|
@ -376,19 +376,9 @@ pub async fn create(
|
||||||
|
|
||||||
// Confirm creation
|
// Confirm creation
|
||||||
println!("\nAbout to create ticket:");
|
println!("\nAbout to create ticket:");
|
||||||
println!("Project: {}", selected_project);
|
|
||||||
if let Some(status) = &metadata.status {
|
|
||||||
println!("Status: {}", status);
|
|
||||||
}
|
|
||||||
if let Some(assignee) = &metadata.assignee {
|
|
||||||
println!("Assignee: {}", assignee);
|
|
||||||
}
|
|
||||||
if let Some(parent) = &metadata.parent {
|
|
||||||
println!("Parent: {}", parent);
|
|
||||||
}
|
|
||||||
println!("Title: {}", title);
|
println!("Title: {}", title);
|
||||||
|
println!("{}", description);
|
||||||
println!("Description:\n{}", description);
|
// println!("{}...", &description.chars().take(100).collect::<String>());
|
||||||
println!("\nPress Enter to continue or Ctrl+C to abort");
|
println!("\nPress Enter to continue or Ctrl+C to abort");
|
||||||
|
|
||||||
let mut input = String::new();
|
let mut input = String::new();
|
||||||
|
|
Loading…
Reference in a new issue