|
|
@@ -9,6 +9,10 @@ pub fn get_releases(owner: &str, repo: &str) -> Result<Vec<Release>, String> { |
|
|
|
let url = format!("{}/repos/{}/{}/releases", GITEA_API_URL, owner, repo); |
|
|
|
let result = client.get(&url).send(); |
|
|
|
if let Ok(resp) = result { |
|
|
|
let status = resp.status(); |
|
|
|
if !status.is_success() { |
|
|
|
return Err(format!("{} {}", status.as_str(), status.canonical_reason().unwrap_or("???"))); |
|
|
|
} |
|
|
|
let result = resp.json::<Vec<Release>>(); |
|
|
|
if let Ok(data) = result { |
|
|
|
return Ok(data); |
|
|
@@ -24,6 +28,10 @@ pub fn get_issue_by_index(owner: &str, repo: &str, index: usize) -> Result<Issue |
|
|
|
let url = format!("{}/repos/{}/{}/issues/{}", GITEA_API_URL, owner, repo, index); |
|
|
|
let result = client.get(&url).send(); |
|
|
|
if let Ok(resp) = result { |
|
|
|
let status = resp.status(); |
|
|
|
if !status.is_success() { |
|
|
|
return Err(format!("{} {}", status.as_str(), status.canonical_reason().unwrap_or("???"))); |
|
|
|
} |
|
|
|
let result = resp.json::<Issue>(); |
|
|
|
if let Ok(data) = result { |
|
|
|
return Ok(data); |
|
|
|