consolidate sharry::api module

This commit is contained in:
Jörn-Michael Miehe 2025-06-27 08:29:57 +00:00
parent 357f455ec0
commit 3f00e08422
3 changed files with 44 additions and 45 deletions

View file

@ -1,41 +0,0 @@
use serde::{Deserialize, Serialize};
#[derive(Serialize, Debug)]
#[allow(non_snake_case)]
pub struct NewShareRequest {
name: String,
validity: u32,
description: Option<String>,
maxViews: u32,
password: Option<String>,
}
impl NewShareRequest {
pub fn new(
name: impl Into<String>,
description: Option<impl Into<String>>,
max_views: u32,
) -> Self {
Self {
name: name.into(),
validity: 0,
description: description.map(Into::into),
maxViews: max_views,
password: None,
}
}
}
#[derive(Deserialize, Debug)]
pub struct NewShareResponse {
pub success: bool,
pub message: String,
pub id: String,
}
#[derive(Deserialize, Debug)]
#[allow(dead_code)]
pub struct NotifyShareResponse {
pub success: bool,
pub message: String,
}

View file

@ -1,7 +1,47 @@
mod id; mod ids;
mod json;
mod uri; mod uri;
pub use id::{AliasID, FileID, ShareID}; use serde::{Deserialize, Serialize};
pub use json::{NewShareRequest, NewShareResponse, NotifyShareResponse};
pub use ids::{AliasID, FileID, ShareID};
pub use uri::Uri; pub use uri::Uri;
#[derive(Serialize, Debug)]
#[allow(non_snake_case)]
pub struct NewShareRequest {
name: String,
validity: u32,
description: Option<String>,
maxViews: u32,
password: Option<String>,
}
impl NewShareRequest {
pub fn new(
name: impl Into<String>,
description: Option<impl Into<String>>,
max_views: u32,
) -> Self {
Self {
name: name.into(),
validity: 0,
description: description.map(Into::into),
maxViews: max_views,
password: None,
}
}
}
#[derive(Deserialize, Debug)]
pub struct NewShareResponse {
pub success: bool,
pub message: String,
pub id: String,
}
#[derive(Deserialize, Debug)]
#[allow(dead_code)]
pub struct NotifyShareResponse {
pub success: bool,
pub message: String,
}