mirror of
https://github.com/mii443/vrchatapi-rust.git
synced 2025-08-22 15:45:35 +00:00
feature: Enable global cookie store
This commit is contained in:
@ -1,9 +1,12 @@
|
||||
pub use vrchatapi::apis;
|
||||
|
||||
fn main() {
|
||||
let config = apis::configuration::Configuration::default();
|
||||
let mut config = apis::configuration::Configuration::default();
|
||||
config.basic_auth = Some((String::from("username"), Some(String::from("password"))));
|
||||
|
||||
let me = apis::authentication_api::get_current_user(&config).unwrap();
|
||||
println!("Username: {}", me.username);
|
||||
|
||||
let online = apis::system_api::get_current_online_users(&config).unwrap();
|
||||
|
||||
println!("Current Online Users: {}", online);
|
||||
}
|
@ -19,4 +19,7 @@ sed -i '/^edition = "2018"/a description="VRChat API Library for Rust"' Cargo.to
|
||||
# Remove messily pasted markdown at top of every file
|
||||
find src -type f -exec sed -i '/VRChat API Banner/d' {} \;
|
||||
|
||||
# Cookie storage
|
||||
sed -i 's/Client::new()/Client::builder().cookie_store(true).build().unwrap()/g' src/apis/configuration.rs
|
||||
|
||||
cargo build
|
||||
|
@ -41,7 +41,7 @@ impl Default for Configuration {
|
||||
Configuration {
|
||||
base_path: "https://api.vrchat.cloud/api/1".to_owned(),
|
||||
user_agent: Some("vrchatapi-rust".to_owned()),
|
||||
client: reqwest::Client::new(),
|
||||
client: reqwest::Client::builder().cookie_store(true).build().unwrap(),
|
||||
basic_auth: None,
|
||||
oauth_access_token: None,
|
||||
bearer_access_token: None,
|
||||
|
Reference in New Issue
Block a user