Move the CreateResult enum into the releases mod
This thing only needs to exist so Serde can decode the response JSON properly. I'll either get a success, a missing token, *no body at all which doesnt' make sense*, or some other ApiError text. In all cases, the crate::Result is returned. This thing doesn't need to be public.
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{
|
||||
structs::release::{CreateReleaseOption, Release}, CreateResult, Result
|
||||
structs::{self, release::{CreateReleaseOption, Release}}, ApiError, Result
|
||||
};
|
||||
|
||||
pub fn get_release(id: u64) -> Result<Release> { todo!(); }
|
||||
@@ -31,6 +33,14 @@ pub async fn list_releases(
|
||||
return Ok(release_list);
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(untagged)]
|
||||
enum CreateResult {
|
||||
Success(structs::release::Release),
|
||||
ErrWithMessage(ApiError),
|
||||
Empty,
|
||||
}
|
||||
|
||||
pub async fn create_release(
|
||||
client: &reqwest::Client,
|
||||
gitea_url: &str,
|
||||
|
||||
@@ -27,10 +27,3 @@ impl From<reqwest::Error> for crate::Error {
|
||||
|
||||
type Result<T> = core::result::Result<T, Error>;
|
||||
|
||||
#[derive(Debug, Deserialize, Serialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum CreateResult {
|
||||
Success(structs::release::Release),
|
||||
ErrWithMessage(ApiError),
|
||||
Empty,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user