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

Gather information to create a new conversation

This commit is contained in:
2020-06-03 18:34:01 +02:00
parent 314e584840
commit 8465f0da65
4 changed files with 60 additions and 1 deletions

View File

@ -264,6 +264,16 @@ impl HttpRequestHandler {
Ok(self.post_string(name)?.parse::<i64>()?)
}
/// Get a boolean included in a POST request
pub fn post_bool(&mut self, name: &str) -> ResultBoxError<bool> {
Ok(self.post_string(name)?.eq("true"))
}
/// Get an optional boolean included in post request
pub fn post_bool_opt(&mut self, name: &str, default: bool) -> bool {
self.post_bool(name).unwrap_or(default)
}
/// Get user ID. This function assess that a user ID is available to continue
pub fn user_id(&self) -> ResultBoxError<UserID> {
match self.curr_user_id {

View File

@ -6,4 +6,5 @@ pub mod api_client;
pub mod user;
pub mod user_token;
pub mod custom_emoji;
pub mod custom_emoji;
pub mod new_conversation;

View File

@ -0,0 +1,14 @@
//! # New conversation information
//!
//! @author Pierre Huber
use crate::data::user::UserID;
#[derive(Debug)]
pub struct NewConversation {
pub owner_id: UserID,
pub name: Option<String>,
pub owner_following: bool,
pub members: Vec<i64>,
pub can_everyone_add_members: bool
}