-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
2 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
{} | ||
{} | ||
pub fn {}(query: {}{}) -> Result<reqwest::blocking::Response, reqwest::Error> {{ | ||
let binding = THANIX_CLIENT.lock().unwrap(); | ||
let state = binding.as_ref().unwrap(); | ||
pub fn {}(state: &ThanixClient, query: {}{}) -> Result<reqwest::blocking::Response, reqwest::Error> {{ | ||
return state.client.{}(format!("{{}}{}?{{}}", state.base_url, serde_qs::to_string(&query).unwrap())).header("Authorization", format!("Token {{}}", state.authentication_token)).send(); | ||
}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
use serde_qs; | ||
use reqwest::Url; | ||
use crate::util::THANIX_CLIENT; | ||
use crate::util::ThanixClient; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
use std::sync::Mutex; | ||
|
||
pub struct ThanixClient { | ||
pub client: reqwest::blocking::Client, | ||
pub base_url: String, | ||
pub authentication_token: String, | ||
} | ||
|
||
pub static THANIX_CLIENT: Mutex<Option<ThanixClient>> = Mutex::new(None); |