Crate pixelast[−][src]
This library is Pixela client for Rust.
Example
ⓘThis example is not tested
use pixelast::{PixelaClient, ConsentAnswer, GraphType, GraphColor}; fn main() { let res = PixelaClient::create_new_user( "username", "usertoken", ConsentAnswer::Yes, ConsentAnswer::Yes ); match res { Ok(()) => println!("create new user."), Err(v) => panic!("create new user failed. {}", v), } let client = PixelaClient::new("username", "usertoken"); client.create_graph("graphid", "graphname", "cal", GraphType::Int, GraphColor::Shibafu).unwrap(); client.update_graph("graphid", "graphname", "cal", GraphColor::Shibafu).unwrap(); client.record_pixel("graphid", "20181016", "10").unwrap(); client.record_pixel("graphid", "20181017", "10").unwrap(); client.record_pixel("graphid", "20181018", "10").unwrap(); client.update_pixel("graphid", "20181018", "20").unwrap(); client.delete_pixel("graphid", "20181016").unwrap(); let pixel = client.get_pixel("graphid", "20181018").unwrap(); println!("{:?}", pixel); client.increment("graphid").unwrap(); client.decrement("graphid").unwrap(); let graphs = client.get_graphs().unwrap(); println!("{:?}", graphs); let svg = client.get_graph_svg("graphid", Some("20181020")).unwrap(); println!("{}", svg); client.delete_graph("graphid").unwrap(); client.delete_user().unwrap(); }
Structs
Graph |
Graph definition in Pixela. |
Pixel |
Data representing the quantity of each day. |
PixelaClient |
A |
Enums
ConsentAnswer |
Answer to the consent from. yes or no. |
GraphColor |
Defines the display color of the pixel in the pixelation graph. |
GraphType |
It is the type of quantity to be handled in the graph. |
PixelaClientError |
The Errors that may occur when processing a Request. |