mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-07-10 17:42:48 +00:00
Add post with weblink support
This commit is contained in:
src
@ -24,6 +24,12 @@ pub struct PostAPI {
|
||||
file_type: Option<String>,
|
||||
file_path: Option<String>,
|
||||
file_path_url: Option<String>,
|
||||
|
||||
// Weblink specific
|
||||
link_url: Option<String>,
|
||||
link_title: Option<String>,
|
||||
link_description: Option<String>,
|
||||
link_image: Option<String>,
|
||||
}
|
||||
|
||||
impl PostAPI {
|
||||
@ -44,17 +50,31 @@ impl PostAPI {
|
||||
file_type: None,
|
||||
file_path: None,
|
||||
file_path_url: None,
|
||||
|
||||
// Weblink specific
|
||||
link_url: None,
|
||||
link_title: None,
|
||||
link_description: None,
|
||||
link_image: None,
|
||||
};
|
||||
|
||||
match &p.kind {
|
||||
PostKind::POST_KIND_TEXT => { /* do nothing */ }
|
||||
|
||||
PostKind::POST_KIND_IMAGE(file) => {
|
||||
post.file_size = Option::from(file.size);
|
||||
post.file_type = file.file_type.clone();
|
||||
post.file_path = Some(file.path.clone());
|
||||
post.file_path_url = Some(user_data_url(file.path.as_ref()))
|
||||
}
|
||||
PostKind::POST_KIND_WEBLINK => {}
|
||||
|
||||
PostKind::POST_KIND_WEBLINK(link) => {
|
||||
post.link_url = Some(link.url.clone());
|
||||
post.link_description = link.description.clone();
|
||||
post.link_title = link.title.clone();
|
||||
post.link_image = link.image.clone();
|
||||
}
|
||||
|
||||
PostKind::POST_KIND_PDF => {}
|
||||
PostKind::POST_KIND_MOVIE => {}
|
||||
PostKind::POST_KIND_COUNTDOWN => {}
|
||||
|
Reference in New Issue
Block a user