Skip to main content

Module user

Module user 

Source
Expand description

User Client

Makes requests for different information about users

§Examples:

For all of the examples you will need to replace the path with the path to your own .env file and add the key “USER_KEY” with you revolt authentication token

This fetchs all the data about the user and prints it out

use volt::user::UserClient;
use dotenv::from_path;
use std::env::var;
 
let path = r#"C:\Users\conno\Downloads\volt\tests\.env"#;
from_path(path).unwrap();
let user: String = var("USER_KEY").unwrap();
let mut client = UserClient::new(user);
println!("{:?}", client.fetch_self().get());

This returns just the id of the user as string

use volt::user::UserClient;
use dotenv::from_path;
use std::env::var;
 
let path = r#"C:\Users\conno\Downloads\volt\tests\.env"#;
from_path(path).unwrap();
let user: String = var("USER_KEY").unwrap();
let mut client = UserClient::new(user);
println!("{:?}", client.fetch_self().get().id());

Structs§

UserClient
The client to acsess user information

Enums§

UserResult
The enum for data returning