mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2025-06-22 01:15:16 +00:00
Add post with images support
This commit is contained in:
@ -37,6 +37,39 @@ pub enum PostPageKind {
|
||||
PAGE_KIND_GROUP(GroupID),
|
||||
}
|
||||
|
||||
#[allow(non_camel_case_types)]
|
||||
pub enum PostKind {
|
||||
POST_KIND_TEXT,
|
||||
POST_KIND_IMAGE(PostFile),
|
||||
POST_KIND_WEBLINK,
|
||||
POST_KIND_PDF,
|
||||
POST_KIND_MOVIE,
|
||||
POST_KIND_COUNTDOWN,
|
||||
POST_KIND_SURVEY,
|
||||
POST_KIND_YOUTUBE,
|
||||
}
|
||||
|
||||
impl PostKind {
|
||||
pub fn to_api(&self) -> String {
|
||||
match self {
|
||||
PostKind::POST_KIND_TEXT => "text",
|
||||
PostKind::POST_KIND_IMAGE(_) => "image",
|
||||
PostKind::POST_KIND_WEBLINK => "weblink",
|
||||
PostKind::POST_KIND_PDF => "pdf",
|
||||
PostKind::POST_KIND_MOVIE => "movie",
|
||||
PostKind::POST_KIND_COUNTDOWN => "countdown",
|
||||
PostKind::POST_KIND_SURVEY => "survey",
|
||||
PostKind::POST_KIND_YOUTUBE => "youtube",
|
||||
}.to_string()
|
||||
}
|
||||
}
|
||||
|
||||
pub struct PostFile {
|
||||
pub path: String,
|
||||
pub size: usize,
|
||||
pub file_type: Option<String>,
|
||||
}
|
||||
|
||||
pub struct Post {
|
||||
pub id: u64,
|
||||
pub user_id: UserID,
|
||||
@ -44,6 +77,7 @@ pub struct Post {
|
||||
pub target_page: PostPageKind,
|
||||
pub content: Option<String>,
|
||||
pub visibility: PostVisibilityLevel,
|
||||
pub kind: PostKind,
|
||||
}
|
||||
|
||||
impl Post {
|
||||
|
Reference in New Issue
Block a user