1
0
mirror of https://gitlab.com/comunic/comunicapiv3 synced 2025-06-21 17:05:16 +00:00

Get information about groups

This commit is contained in:
2020-06-24 18:23:44 +02:00
parent ed498a73d6
commit dc58357b2e
3 changed files with 109 additions and 3 deletions

View File

@ -2,14 +2,34 @@
//!
//! Group visibility level
use crate::data::group_id::GroupID;
#[allow(non_camel_case_types)]
#[derive(Eq, PartialEq, Hash)]
#[derive(Eq, PartialEq, Hash, Debug)]
pub enum GroupVisibilityLevel {
OPEN_GROUP,
PRIVATE_GROUP,
SECRETE_GROUP,
}
#[allow(non_camel_case_types)]
#[derive(Eq, PartialEq, Hash, Debug)]
pub enum GroupRegistrationLevel {
OPEN_REGISTRATION = 0,
MODERATED_REGISTRATION = 1,
CLOSED_REGISTRATION = 2,
}
#[allow(non_camel_case_types)]
#[derive(Eq, PartialEq, Hash, Debug)]
pub enum GroupPostsCreationLevel {
//Only the moderators and the administrator can create posts
POSTS_LEVEL_MODERATORS = 0,
//All the members of the group can create posts
POSTS_LEVEL_ALL_MEMBERS = 1,
}
#[allow(non_camel_case_types)]
#[derive(Eq, PartialEq, Hash, Debug, PartialOrd)]
pub enum GroupAccessLevel {
@ -32,6 +52,22 @@ pub enum GroupAccessLevel {
ADMIN_ACCESS = 5,
}
/// Group information
#[derive(Debug)]
pub struct Group {
pub id: GroupID,
pub name: String,
pub members_count: u64,
pub visibility: GroupVisibilityLevel,
pub registration_level: GroupRegistrationLevel,
pub posts_creation_level: GroupPostsCreationLevel,
pub logo: Option<String>,
pub virtual_directory: Option<String>,
pub time_create: u64,
pub description: Option<String>,
pub url: Option<String>,
}
#[cfg(test)]
mod tests {
use crate::data::group::GroupAccessLevel;