draft
This commit is contained in:
parent
59207e3efc
commit
d26183445e
2 changed files with 18 additions and 5 deletions
|
@ -1,8 +1,7 @@
|
||||||
use dotenv::dotenv;
|
mod mattermost; // importe le module mattermost
|
||||||
use std::env;
|
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
// Vérification si fichier .env trouvé
|
let res = mattermost::connexion();
|
||||||
dotenv().expect("Le fichier .env n'a pas été trouvé...");
|
|
||||||
let _token = env::var("TOKEN").expect("Token non trouvé dans le fichier .env");
|
println!("{:?}", res);
|
||||||
}
|
}
|
||||||
|
|
14
src/mattermost.rs
Normal file
14
src/mattermost.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
|
||||||
|
/// Se connecte à Mattermost depuis Gitlab
|
||||||
|
#[tokio::main]
|
||||||
|
pub async fn connexion() -> Result<reqwest::Response, reqwest::Error> {
|
||||||
|
let client = reqwest::Client::new();
|
||||||
|
|
||||||
|
let params = [("foo", "bar"), ("baz", "quux")];
|
||||||
|
let res = client.post("http://httpbin.org/post")
|
||||||
|
.form(¶ms)
|
||||||
|
.send()
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
Ok(res)
|
||||||
|
}
|
Reference in a new issue