acf8eadf47 | ||
---|---|---|
cli | ||
client | ||
jsonrpc2-client | ||
rawclient | ||
types | ||
.gitignore | ||
Cargo.lock | ||
Cargo.toml | ||
README.md |
README.md
socialvoid-rs
This repository contains
- a crate that is a high level implementation of a library to access the Socialvoid API. It can be used to build clients for the platform or build automated programs to perform tasks on the Socialvoid network.
- a simple CLI client for Socialvoid based on the crate
Library Documentation
//TODO: link to this crate's documentation once it's up.
Incase any method isn't available in this crate, you can make raw requests using the socialvoid-rawclient
crate, the latest full API Documentation of Socialvoid is here
Example for the library
A simple example that logs you in and shows peer information.
// You need to make a file called `test_creds.test` in the root of the project for this example to run
// The file is a JSON file with the following format
// {
// "username":"yourusername",
// "password":"yourpassword"
// }
#[tokio::main]
async fn main() {
let creds: serde_json::Value =
serde_json::from_str(&std::fs::read_to_string("test_creds.test").unwrap())
.expect("Couldn't read the credentials. Check the JSON format or something");
let mut client = socialvoid::new_with_defaults().await.unwrap();
client
.authenticate_user(
creds["username"].as_str().unwrap().to_string(),
creds["password"].as_str().unwrap().to_string(),
None,
)
.await
.unwrap();
let peer = client.get_me().await.unwrap();
println!("{:?}", peer);
client.logout().await.unwrap();
assert_eq!(
peer.username,
creds["username"].as_str().unwrap().to_string()
);
}
More examples can be found in client/examples
Installation of the CLI client
- Clone this repository
cd
into the repository- Install the cli
cargo install --path cli
Usage of the CLI client
See the full documentation here(TODO: a link to full documentation)
Some of the commands are:
Register an account
socialvoid-cli register
Login in to an account
socialvoid-cli login
Get the current peer
socialvoid-cli get-me
//TODO: add contributors section