use mattermost_api

This commit is contained in:
Mylloon 2021-12-21 09:21:25 +01:00
parent 76772e53f3
commit 9b3aeaf6ac
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -1,13 +1,11 @@
use mattermost_api::prelude::*;
/// Se connecte à Mattermost depuis Gitlab /// Se connecte à Mattermost depuis Gitlab
#[tokio::main] pub async fn connexion(token: &str) {
pub async fn connexion() -> Result<reqwest::Response, reqwest::Error> { let auth = AuthenticationData::from_access_token(&token);
let client = reqwest::Client::new(); let mut api = Mattermost::new("https://talk.up8.edu", auth);
api.store_session_token().await.unwrap();
let team_info = api.get_team_info("etudiant-es").await.unwrap();
let params = [("foo", "bar"), ("baz", "quux")]; println!("{:?}", team_info);
let res = client.post("http://httpbin.org/post")
.form(&params)
.send()
.await?;
Ok(res)
} }