use std::sync::{Arc};
use reqwest::Response;
use serde::{Deserialize, Deserializer};
use serde_json::Value;
use crate::api::ApiClient::ApiClient;
use anyhow::Result;
use tokio::sync::{Mutex, MutexGuard};
use crate::api::user::BungieUser::{DestinyPlatform, BungieUser};
pub struct ApiInterface {
pub client: ApiClient,
}
impl ApiInterface {
pub async fn new(apikey: &str, debug: bool) -> Self {
let mut client = ApiClient::new(apikey);
if debug {
client = client.enable_debug_mode().await;
}
Self {
client,
}
}
pub async fn get_user_by_id(&self, id: String, platform: DestinyPlatform) -> Result<BungieUser> {
BungieUser::get_user_by_id(&self.client, id, platform).await
}
}
pub const URL_BASE: &str = "https://www.bungie.net/Platform";