Other changes for Tauri

This commit is contained in:
Igor Katson 2023-12-02 15:59:20 +00:00
parent 99db087cf1
commit fe04e17d63
No known key found for this signature in database
GPG key ID: B4EC22B66D61A3F5
6 changed files with 16 additions and 23 deletions

View file

@ -11,6 +11,14 @@ pub struct ApiError {
}
impl ApiError {
pub fn new_from_string(status: StatusCode, text: String) -> Self {
Self {
status: Some(status),
kind: ApiErrorKind::Other(anyhow::anyhow!("{}", text)),
plaintext: false,
}
}
pub const fn torrent_not_found(torrent_id: usize) -> Self {
Self {
status: Some(StatusCode::NOT_FOUND),

View file

@ -185,10 +185,13 @@ fn compute_only_files<ByteBuf: AsRef<[u8]>>(
#[serde_as]
#[derive(Default, Clone, Serialize, Deserialize)]
pub struct AddTorrentOptions {
#[serde(default)]
pub paused: bool,
pub only_files_regex: Option<String>,
pub only_files: Option<Vec<usize>>,
#[serde(default)]
pub overwrite: bool,
#[serde(default)]
pub list_only: bool,
pub output_folder: Option<String>,
pub sub_folder: Option<String>,