Update func name + Clippy
This commit is contained in:
parent
a2a62b0fec
commit
a676e33c56
2 changed files with 11 additions and 10 deletions
|
@ -80,7 +80,7 @@ async fn main() {
|
|||
message_erreur("Équipe non trouvé dans le fichier .env")
|
||||
)
|
||||
});
|
||||
mattermost::test(&api, &equipe).await;
|
||||
mattermost::team_info(&api, &equipe).await;
|
||||
}
|
||||
|
||||
/// Jolie message d'erreur
|
||||
|
|
|
@ -23,7 +23,7 @@ pub async fn connexion(
|
|||
}
|
||||
|
||||
trait Affichage {
|
||||
/// Affichage propre de l'équipe
|
||||
/// Renvoie un affichage "propre" concernant l'équipe
|
||||
fn fprint(self) -> String;
|
||||
}
|
||||
|
||||
|
@ -47,11 +47,11 @@ impl Affichage for mattermost_api::models::TeamInformation {
|
|||
|
||||
let creation: DateTime<Utc> =
|
||||
DateTime::from_utc(NaiveDateTime::from_timestamp(self.create_at, 0), Utc);
|
||||
res += &format!("\nDate de création => {}", creation.format(format_date));
|
||||
res += &format!("\nDate de création => {}", creation.format(format_date));
|
||||
|
||||
let mise_a_jour: DateTime<Utc> =
|
||||
DateTime::from_utc(NaiveDateTime::from_timestamp(self.update_at, 0), Utc);
|
||||
res += &format!(
|
||||
res += &format!(
|
||||
"\nDernière mise-à-jour => {}",
|
||||
mise_a_jour.format(format_date)
|
||||
);
|
||||
|
@ -59,7 +59,10 @@ impl Affichage for mattermost_api::models::TeamInformation {
|
|||
if self.delete_at != 0 {
|
||||
let suppression: DateTime<Utc> =
|
||||
DateTime::from_utc(NaiveDateTime::from_timestamp(self.delete_at, 0), Utc);
|
||||
res += &format!("\nDate de suppression => {}", suppression.format(format_date));
|
||||
res += &format!(
|
||||
"\nDate de suppression => {}",
|
||||
suppression.format(format_date)
|
||||
);
|
||||
}
|
||||
|
||||
res += &format!("\nEmail => {}", self.email);
|
||||
|
@ -86,11 +89,9 @@ impl Affichage for mattermost_api::models::TeamInformation {
|
|||
}
|
||||
}
|
||||
|
||||
/// Test que tout fonctionne en renvoyant des informations sur une équipe
|
||||
pub async fn test(api: &mattermost_api::client::Mattermost, equipe: &str) {
|
||||
let team_info = api.get_team_info(equipe).await;
|
||||
|
||||
match team_info {
|
||||
/// Affiche les informations complète sur une équipe
|
||||
pub async fn team_info(api: &mattermost_api::client::Mattermost, equipe: &str) {
|
||||
match api.get_team_info(equipe).await {
|
||||
Ok(infos) => {
|
||||
println!("{}", infos.fprint());
|
||||
}
|
||||
|
|
Reference in a new issue