consolidate sharry::api module
This commit is contained in:
parent
357f455ec0
commit
3f00e08422
3 changed files with 44 additions and 45 deletions
|
|
@ -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,
|
||||
}
|
||||
|
|
@ -1,7 +1,47 @@
|
|||
mod id;
|
||||
mod json;
|
||||
mod ids;
|
||||
mod uri;
|
||||
|
||||
pub use id::{AliasID, FileID, ShareID};
|
||||
pub use json::{NewShareRequest, NewShareResponse, NotifyShareResponse};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub use ids::{AliasID, FileID, ShareID};
|
||||
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,
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue