impl print trait for the team info
This commit is contained in:
parent
2182791142
commit
835dd470ca
1 changed files with 50 additions and 1 deletions
|
@ -21,13 +21,62 @@ pub async fn connexion(
|
||||||
api
|
api
|
||||||
}
|
}
|
||||||
|
|
||||||
|
trait Affichage {
|
||||||
|
/// Affichage propre de l'équipe
|
||||||
|
fn print(self);
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Affichage for mattermost_api::models::TeamInformation {
|
||||||
|
fn print(self) {
|
||||||
|
println!("ID => {}", self.id);
|
||||||
|
|
||||||
|
println!("Type => {}", self.type_);
|
||||||
|
|
||||||
|
println!("Nom => {}", self.name);
|
||||||
|
|
||||||
|
println!("Nom d'affichage => {}", self.display_name);
|
||||||
|
|
||||||
|
if !self.description.is_empty() {
|
||||||
|
println!("Description => {}", self.description);
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("Date de création => {}", self.create_at);
|
||||||
|
|
||||||
|
println!("Dernière mise-à-jour => {}", self.update_at);
|
||||||
|
|
||||||
|
if self.delete_at != 0 {
|
||||||
|
println!("Date de suppression => {}", self.delete_at);
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("Email => {}", self.email);
|
||||||
|
|
||||||
|
let invitation;
|
||||||
|
if self.allow_open_invite {
|
||||||
|
invitation = "Vrai";
|
||||||
|
} else {
|
||||||
|
invitation = "Faux";
|
||||||
|
}
|
||||||
|
println!("Invitation ouverte à tous => {}", invitation);
|
||||||
|
|
||||||
|
if !self.allowed_domains.is_empty() {
|
||||||
|
println!("Nom de domaines autorisés => {}", self.allowed_domains);
|
||||||
|
}
|
||||||
|
|
||||||
|
println!("ID d'invitation => {}", self.invite_id);
|
||||||
|
|
||||||
|
if let Some(id) = self.policy_id {
|
||||||
|
println!("ID de la politique d'utilisation => {}", id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Test que tout fonctionne en renvoyant des informations sur une équipe
|
/// Test que tout fonctionne en renvoyant des informations sur une équipe
|
||||||
pub async fn test(api: &mattermost_api::client::Mattermost, equipe: &str) {
|
pub async fn test(api: &mattermost_api::client::Mattermost, equipe: &str) {
|
||||||
let team_info = api.get_team_info(equipe).await;
|
let team_info = api.get_team_info(equipe).await;
|
||||||
|
|
||||||
match team_info {
|
match team_info {
|
||||||
Ok(infos) => {
|
Ok(infos) => {
|
||||||
println!("Information sur la team : {:?}", infos);
|
infos.print();
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
println!("Error: {}", e);
|
println!("Error: {}", e);
|
||||||
|
|
Reference in a new issue